Simon Kitching wrote:
Steve Cohen schrieb:
Simon Kitching wrote:
Steve Cohen schrieb:
I am using jsvc to run a non-Tomcat java application as a daemon.
I would like to achieve rotation of the system.out and system.err
logs. This is running on a Linux system, but I am by no means a Linux
guru and when I see information like "support proper log rotation
using SIGUSR1" I don't know what that means.
Can someone provide a pointer to a more basic explanation for how to
keep these logs rotated?
I'm not a commons-daemon developer, but took a quick look anyway.
I guess your comment about "rotation using SIGUSR1" is referring to this
jira issue:
http://issues.apache.org/jira/browse/DAEMON-95
That issue is still open, so as far as I can see jsvc does NOT support
this.
I can't see any other hint that jsvc supports log rotation, other than
stopping and restarting the service.
Note that a well-designed java app should not be writing much to stdout
or stderr, so log rotation for that shouldn't be all that important. If
you are getting lots of logging output, maybe the logging configuration
for the application itself is misconfigured? Most java apps use either
log4j, logback or java.util.logging's default loggers to write messages
and those can all be configured in various ways.
Regards,
Simon
I am using log4j. Perhaps I need to turn off stdout logging. But
there are still other things being written by support libraries that
I've never been able to figure out how to direct into log4j - Most
notably Hibernate, which logs the SQL to stdout and not to the log4j
logs. If I could figure that out, this would get much less acute.
I'm a little surprised that you have Hibernate SQL logging enabled in
what sounds like a production system (dev systems wouldn't be be running
as a service using jsvc).
Good point about Hibernate logging in production. On the other hand, we
run jsvc in development also, which was necessary to shake out our
experience using jsvc itself. The logfile size is an issue in both. In
any case, it's not a bad practice to make dev environment resemble
production as much as possible.
But if Hibernate logging always writes to stdout then yes that is a problem.
It doesn't, I'm sure, but I've never been able to get the control of it
that I wish. One of these nagging issues one never has time to solve.
It does sound like you should add a "me too" note to that JIRA issue in
case that pushes someone to commit the patch (or DAEMON-80 which uses
syslog instead). Until then maybe you should build your own version of
jsvc with that patch applied. Then you could have a cron script that does:
* mv system.out system.out.old
* kill -s SIGUSR1 pidOfJsvc (force jsvc to reopen logfiles, ie create
new system.out)
* wait a few seconds, or until file "system.out" is created
* now can safely move system.out.old to somewhere else
Cheers,
Simon
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]