Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 04-29-2012, 05:42 AM   #1
G.S. Rashkovich
Junior Member
G.S. Rashkovich began at the beginning.
 
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 05:45 AM.
G.S. Rashkovich is offline   Reply With Quote
Old 04-29-2012, 05:48 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,433
Karma: 5383257
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
echo > log_file

You cannot rotate log files in windows, Windows locks all open files.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 04-29-2012, 10:56 AM   #3
G.S. Rashkovich
Junior Member
G.S. Rashkovich began at the beginning.
 
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?
G.S. Rashkovich is offline   Reply With Quote
Old 04-29-2012, 11:14 AM   #4
itimpi
Wizard
itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.itimpi ought to be getting tired of karma fortunes by now.
 
Posts: 4,102
Karma: 780247
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?
itimpi is offline   Reply With Quote
Old 04-29-2012, 12:04 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,433
Karma: 5383257
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
kovidgoyal is offline   Reply With Quote
Old 05-04-2012, 05:12 AM   #6
G.S. Rashkovich
Junior Member
G.S. Rashkovich began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
Quote:
Originally Posted by itimpi View Post
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?
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.
G.S. Rashkovich is offline   Reply With Quote
Old 05-04-2012, 05:38 AM   #7
G.S. Rashkovich
Junior Member
G.S. Rashkovich began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Apr 2012
Device: smartphone on MTK6235 chipset
Quote:
Originally Posted by kovidgoyal View Post
Do I really need to SPELL it out?

cp log.txt archived-log.txt
echo > log.txt
Well, you may spell it or cast it or even sing it - but it doesn't work.

Sorry, I'm not a Python programmer, but is it so difficult to write to rotated log file? log() system call works good enough...
G.S. Rashkovich is offline   Reply With Quote
Old 05-04-2012, 05:46 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 26,433
Karma: 5383257
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.
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre Log on Windows? RoninTech Calibre 5 07-06-2013 10:35 AM
Is there any way to let kindle only rotate PDF files? JackLiu Amazon Kindle 6 09-25-2010 09: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 08:49 PM
Calibre Viewer: How to rotate the page? jschall Calibre 6 08-27-2009 04:26 PM


All times are GMT -4. The time now is 03:43 PM.


MobileRead.com is a privately owned, operated and funded community.