midas.log erased if /logger/message file is set to midas_%Y.log
I changed “/logger/message file” to midas_%Y.log and to my surprise my midas log file midas.log was erased (replaced by a symlink). I am lucky to have done it on a test setup and I did not have to restore my last 10 years of midas.log messages from backups.
I think we should not erase midas.log (and other log files), complain and ask the user to rename them manually, or rename them ourselves, but not erase.
K.O.
Comments (5)
-
-
reporter Tried it, it worked. K.O.
-
reporter This is the filenames I get:
-rw-r--r-- 1 olchansk users 28421333 Aug 10 11:36 /home/olchansk/daq/expt/midas_2020.log lrwxrwxrwx 1 olchansk users 40 Aug 10 11:36 /home/olchansk/daq/expt/midas.log -> /home/olchansk/daq/expt/./midas_2020.log
Would it be better to have symlinks “midas.log → midas_2020.log instead of → /full/path/midas_2020.log?
Right now, if the message directory is renamed or moved or the nfs-mount point changes, the symlink will break.
(this means we have to return 3 items, not 2: filename /full/path/midas_2020.log, linkname /full/path/midas.log and link target “midas_2020.log” (without the directory part).
K.O.
-
Makes sense.
-
reporter - changed status to resolved
- Log in to comment
I added code to copy midas.log to midas_%Y.log in that case (actually append the contents of midas.log to midas_%Y.log if that file already exists).