-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hong,

On 5/15/12 12:05 PM, Le, Hong D. wrote:
> It's a tomcat on windows so some options of logs or files rotation 
> available on Li/Unix won't work.

Oh, that's really too bad.

> I tried to write script to rotate but failed b/c as you said, I
> can't move log files while tomcat is running.

Yeah, that's just how things work.

> Neither Log4j.

Well, you can't make log4j take-over stdout (at least not that I know of).

You might be able to hack Tomcat to to this for you, though. If you
write a component like a LifecycleListener that runs a) in Tomcat's
ClassLoader and b) has all security permissions (if running under a
SecurityManager), you might be able to re-assign System.out to a
stream of your choosing.

Of course, you'd have to write a stream that was capable of doing what
you want, but you might even be able to just pipe everything (probably
broken by newlines) to a "real" logger that can do rotation, such as
j.u.logging or even log4j.

> I also tried swallowOutput (mine is Tomcat7), but it doesn't work
> for me.

That's only for webapps, not for the core of Tomcat. So, you're out of
luck where swallowOutput is concerned.

> I have to deal with it on production. That's the problem. Please 
> don't ask me why, just b/c that's the business I have.

I certainly don't envy your position. What are you doing with all that
debugging information? It's non-standard, probably impossible to
parse, etc. Why not use a Filter that captures the information you
*actually need* and log that appropriately? I realize you are probably
operating under  policy of stupidity that you can't change, but maybe
you haven't thought of everything ;)

> So maybe another question is how to do logging-pipe and rotate (as 
> you said) for JSSE?

I couldn't find any JSSE-specific logging configuration, so I suspect
that stdout is what you get with no other choices. That said, you
still might have options. I don't know how stable pipes are on win32,
but I would be comfortable launching a piped log process on *NIX to
monitor a log file as long as necessary. You could definitely try it
on win32 and see what happens. Something like this:

http://httpd.apache.org/docs/2.2/logs.html#piped

Those instructions are for Apache httpd. You can't configure Tomcat to
log in this way, but you can do your own shell-based output
redirection using "[...] | rotatelogs [...]" instead of "[...] >
logs/catalina.out [...]" -- just hack catalina.bat.

If you are running Tomcat as a service, I think you are pretty much
entirely out of luck, unless there is some commons-daemon option that
I don't know about to pipe stdout to a process instead of a file on
the disk. Does win32 have named-pipes?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+yjCsACgkQ9CaO5/Lv0PBysACfVg5wokI5XG3pOP2jvEHa1adU
va8AnjeX+K1ZWQAWCXu71DGmVxZqgRlz
=M7pN
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to