(Install details: apache-tomcat-7.0.40.exe on Win10 圆4.) Here's a screenshot of Procrun's "Logging" tab after fresh install with all defaults: In a default install this is a shortcut that starts "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\Tomcat7w.exe" //MS//Tomcat7Īnd starting this will take you directly to Procrun's Logging tab. The Windows icon is just labeled Monitor Tomcat. Let's start the GUI and see what they are. Instead Procrun will create some log files. Procrun does NOT use the standard Windows Event Logging Framework. But I will just gloss over this and pretend it's all called "Procrun". Procrun has a GUI and strictly speaking this GUI is called " Prunmgr". And the Win32 version is called "Procrun". There are Unix and Windows versions of this. The internal mechanism for this is called the Commons Daemon Service Manager. The default Windows installer will register Tomcat as a service. So I've settled for NOT using swallowOutput. Also the description on Apache sounded scary. ** Update:, I've tried it and it didn't work at all for my webapps. Another thing not tried yet: Tomcat's swallowOutput attribute. (Not even with the copytruncate directory that is supposed to do just that.) Maybe I'll give it another try in the future. I've considered using LogRotateWin but couldn't get it work with files locked for access.And the automated weekly delage32 job cleans up these old files after a while. The automated weekly restart ensures that Procrun will start a fresh (and timestamped) set of these three files. But I hope to somehow limit the size they can grow to by using a combination of a weekly restart along with a cleanup job. I've (for now) decided to keep Procrun's logs (commons-daemon, stdout, stderr).(The reasoning is the same: no need to log things twice.) I've minimized what goes into catalina.out/stdout/stderr files from Tomcat itself: As per Apache's recommendation I've removed ConsoleHandler from logging.properties.(After all: no need to have the same logs both inside the webapps' own Log4J-managed logs AND in catalina.out/stderr/stdout?) I've minimized what goes into catalina.out/stdout/stderr files from my webapps: I've removed all console logging from the webapps' own logging configuration.Medium version: I'm not super happy with the solution but for the Tomcats I have to administer I've set up several things: Then none of the three log files (commons-daemon, stderr, stdout) will be created. But here's a dirty hack to stop Procrun from logging altogether: Set Log Path: to NOTADRIVE: (including the trailing :). Is there some configuration somewhere or can I override the config with my own Log4j config? So where can I configure the stdout, stderr and commons-daemon logs? The usage of this tool is pretty straightforward and a quick run through these links should get you what you need.ĭisable log file creation inside Procrun GUI There's a simple tool called logrotate available to achieve the desired effect on logs you do not have control over. If the above approach doesn't work you can try using an external utility as mentioned in the second approach Second Approach: Configure externally with "logrotate" (On YourAppender now you can set MaxBackupIndex and MaxFileSize to achieve your defined number of rollovers and a limit on the log size. Your logger will look like this:- .catalina=INFO, YourAppender In your log4j.properties add config to redirect your logs to your own log file. (This swallows all your stdout/stderr and redirects to your underlying logging system.) First Approach: Configure internally in Tomcatįind context.xml in Tomcat in the path :- YourTomcatInstallDir\conf\context.xmlĮdit the context tag to add swallowOutput="true" like below:. However i found two approaches that people take for dealing with "tomcat logs crossing limits". Looked into the commons-daemon first to see if there is any configuration we can do to achieve a maxbackupindex on the logs but the search didn't help much. So was keen on finding some solution/workaround myself. I foresee us having a similar requirement/facing same issue some time later in future on one of our systems. So where can I configure the stdout, stderr and commons-daemon logs? Is there some configuration somewhere or can I override the config with my own Log4j config? Thx So I would prefer a RollingFileAppender with maxBackupIndex to prevent unlimited growth of the logs. The files which get created although they are NOT in my configuration are:Īs you see they use a DailyRollingFileAppender, which is not desired, as I need a maintenance free system. # Configure which loggers log to which appenders I'm using Apache Tomcat 7.0.40 with Log4j config according to Įverything's working as expected, except that some log files are created, which are actually not configured in my log4j.properties: log4j.rootLogger=INFO, CATALINA
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |