There is a java process that makes logging to some file, e.g. err.log. I renamed it (w/o restarting java process), e.g. "mv err.log err.log0" and then see that java process continues logging to err.log0.
Why is that and what's logic behind it? Is it common for all unix/Linux platforms?
The process will have opened it's log file when it started and will have kept it open. It will be writing to the file using the file descriptor that was created when the file was opened. The name of the file has no relationship with the file descriptor once it's opened so changing the name doesn't affect the process writing to it. This is normal and expected.
If you want your process to open a new log file then it will have to be written to accept a signal to tell it to close the old file and open a new one.
To add to that, you can actually have the file open with no filename at all. Say you deleted that file, the process will continue to write to it, and it will continue to take up space on the disk. When it's closes it will get deleted. You can also have the same file accessible by multiple filenames which you can create with the "ln" command. Opening and immediately deleting the directory entry for a file is a common way to make sure the space for a temporary file gets freed up when the process exits even if it crashes. The "-i" option to "ls" will include the inode number so you can tell which filenames go to the same file.
Just in case what you were trying to do was to rotate the logfile without restarting the Java process, here is a way that should work:
This actually copies the log and then truncates it (sets its size to zero) so you need extra disk space, but the app should continue logging to err.log afterwards.