thank you very much for your detailed explanation , now i just resolved it with another way, i used a cronlog.exe which is a executable file and can be used for produce daily files; and other configration is the same as my primary way.
thank you all the same! best regards ------------------ ???????? ------------------ ??????: "Christopher Schultz";<ch...@christopherschultz.net>; ????????: 2014??3??20??(??????) ????10:11 ??????: "Tomcat Users List"<users@tomcat.apache.org>; ????: Re: ?????? tomcat 5 logs -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 ????????, On 3/20/14, 12:30 AM, ???????? wrote: > the source of my problem is that in the application ,we just used > many system.out sentence as a log output instead of using log4j, > because it is really a old applicaiton ; now we need to capture > the the system.out information as a log; You should take a look at the "swallowOutput" setting for your <Context> element. You can find documentation about it here: https://tomcat.apache.org/tomcat-5.5-doc/config/context.html Setting swallowOutput="true" will cause System.out and System.err within the application to be routed to the context-logger, which you should be able to redirect to a rotatable log file. To configure the context logger, edit Tomcat's conf/logging.properties file. There should already be some configuration like this: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler These lines configure loggers for specific applications: the first pair of lines set up the logger for the "manager" application while the second pair configure those for the "host-manager" application. To set up one for your own application, do the following: Create a new "handler" (what actually writes to a file): 10my-context-path.org.apache.juli.FileHandler.level = FINE 10my-context-path.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 10my-context-path.org.apache.juli.FileHandler.prefix = my-context-path. Configure the context to write to the handler: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/my-context-path].handler=10my-context-path-handler.org.apache.juli.FileHandler Set the logging level: org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/my-context-path].level=INFO (or ERROR, WARN, FINE, FINEST, ALL) The above, along with swallowOutput="true" will take System.out.println("Some log message") from your web application deployed to "/my-context-path" and put it into CATALINA_BASE/logs/my-context-path.[yyyy-MM-dd].log. The file should be automatically rotated daily. In case it's not obvious, the "my-context-path" text above should be replaced with whatever your webapp's context path actually is. You can call the log filename anything you want, and you can name the logger (almost) anything you want -- check the documentation[1] -- but the line with the [Catalina].[localhost].[/my-context-path] must match your Service/Host/Context names (note the leading '/' in the context path in the final portion of the logger name). Finally, you should really upgrade. Tomcat 5 has been retired quite some time ago, and Tomcat 6 will be considered for the chopping block once Tomcat 8 is released. Fortunately, all of the above logging configuration is available in Tomcat 5.5, 6.0, 7.0, and 8.0 so it should still work for you if you upgrade. Good luck, - -chris [1] https://tomcat.apache.org/tomcat-5.5-doc/logging.html#java.util.logging -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBCAAGBQJTKvb9AAoJEBzwKT+lPKRYTKwQALKn+WqCHpEZpR6u4xt78cL3 wGceVd5nofSO0AK5A+FWFp80BhMWtucObmk11F4ZkasaLokFxQxmscA6UZt6pT7+ GCgM65R9uNvUqf15c/rL6KytKpI2mXvQRc4I+/HCIwZnELIu0+2j1BVoZsrB0Ms6 rBetukD/pHdWub5lPQGmOlgwt0tlb6Yam93+h9KpAd1CZLmpAHIY6pVZeDcX1ZNC j3MqMUspQxo0+SIH+RQ0MFwbWwsZ0aPM4rulGGXDJtlVQZNpcDeL94YbucC5Remt yDnmWQOuAZ/tyXsbbAfZWLRMtAEftMEsdFnYXDqXSKv71Un6NpoLOUvsSMqHYuyh +IgiOqkpNiZUjQdJPztXZNFxOZWtlGJd3A60NGWU+5X2ZnDRfJ4dbCTBHsEFG4Fy I/YIYhQQFuEj3ANsfpTjBSRhPtpeVlR65CUcReSEaM9hkDs4DKS2HLt15gzUSUIa vRFoALkihS7esqrjhd+/Rexy/loz8kGX2tqGchj8DgENO2XL6FG/9QCu6p/Wv6kc XXVsRKBkImE45YrVqjFnQNmjDhvckXr6nL/9lKE0gOkWWPneiDu3KXK0Vb3qFtf0 ASW7nC/umCOgdm5ERyGQhYm4Jry5Lco76BaUfSvtz9lFpMaiyk3yjunNVvcG/qVe YiQQU321q/pgARYMHoMH =5dC/ -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org .