04-29-2012, 04:42 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
|
How to rotate pycherry (Calibre) log files?
Hi all!
How should I rotate calibre_access_log.txt and calibre_error_log.txt under unixes? Yeah, I know how to use newsyslog/logrotate... But Calibre access server doesn't use new logs after rotation until I stop/start it. So the question is - should I (well, not me, but newsyslog or whatsaelse:-) send some signal to server? Which signal and to which PID? Or should I use any other technique? And, by the way, what to do under M$ Windows? WBR, G.S. Rashkovich Last edited by G.S. Rashkovich; 04-29-2012 at 04:45 AM. |
04-29-2012, 04:48 AM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
echo > log_file
You cannot rotate log files in windows, Windows locks all open files. |
Advert | |
|
04-29-2012, 09:56 AM | #3 |
Junior Member
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
|
Once more, the same question...
Thanks for a quick answer.
But..."echo > log.txt" :-)...Was it a joke? Once more, Calibre access server doesn't use new logs after rotation until I stop/start it. The same one is with "echo...", of course, plus delete old file. I asked, how to ROTATE logs. In other words, how to switch to new log file, not how to truncate/delete it. And the main part of question - how to do it WITHOUT SERVER RESTART. I didn't mean just delete/truncate log with "echo", "rm", "truncate" etc. It's easy but out of use. I need logs and just want to rotate them like any other server does. Maybe, with sending signal 15 or signal SIGUSR* or something like it. Isit possible or should it be possible in future? |
04-29-2012, 10:14 AM | #4 |
Wizard
Posts: 4,552
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
|
As far as I know it is only possible with a server restart. However since that only takes seconds is it really a big issue?
|
04-29-2012, 11:04 AM | #5 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Do I really need to SPELL it out?
cp log.txt archived-log.txt echo > log.txt |
Advert | |
|
05-04-2012, 04:12 AM | #6 |
Junior Member
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
|
Well, as for me - it's big enough, because ,logs rotated automatically at 3:00am or at <some> Mbytes, and all activity after it lost until I restart calibre manually.
|
05-04-2012, 04:38 AM | #7 | |
Junior Member
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
|
Quote:
Sorry, I'm not a Python programmer, but is it so difficult to write to rotated log file? log() system call works good enough... |
|
05-04-2012, 04:46 AM | #8 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes, it does. I dont need to be a python programmer to know that. All I need to know is that files on linux are opened by inode number. Which means that the first call to cp will copy the existing log, the second call to echo will truncate the file *without changing its inode number* which means that calibre will continue to write new entries to the truncated file.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre Viewer: How to rotate the page? | jschall | Calibre | 7 | 08-15-2015 08:59 PM |
Calibre Log on Windows? | RoninTech | Calibre | 5 | 07-06-2013 09:35 AM |
Is there any way to let kindle only rotate PDF files? | JackLiu | Amazon Kindle | 6 | 09-25-2010 08:08 PM |
PRS-600 Log files disappearing after SD card unmount (buggy sync?), anyone seen this before? | Xaphiosis | Sony Reader Dev Corner | 2 | 07-12-2010 07:49 PM |