Posted by: Chyne on: September 15, 2009
Today, there is a customer requesting solution on how to change the location path of stdout.log to D:/ drive due to the file size is getting huge.
My mind was focusing on log4j.properties configuration. I shouldn’t confused her with that solution since she sounds like a newbie but I just never thought after several months, she still a newbie. Few months ago, I asked her whether she installed the application in WAR or standalone and she told me that she doesn’t even know what kind of installation that she’s currently using and it was installed by her ex-colleague that has left the company. Well, after several months, I thought she must be improved a lot and her knowledge has increased in order to replace her ex-colleague but unfortunately, she still confused which installation folder that the application is located. I asked her whether she found the log4j.properties and she told me that she found it and copied it into another folder in the WAR installation.
However, after several conversations, she was getting confused again and asked me which folder she should configured and telling me how I know it’s the installation directory and not the Tomcat directory? I told her that the configuration should be in the installation folder and she’s fine. At least I was able to stop her confusion for a while before she keeps struggle either folder A or folder B. Then, I asked her whether she found the log4j.properties in the specific directory and she told me she can’t find it. Huh? She was just telling me that she copied the file into the installation folder. I reminded her about this and her answer is “Oh. I had deleted that file. Let me create it again.”
I had asked around about this question and their answers are:
1) Modfied the server.xml?
2) Create a log4j.properties and save it in the $CATALINA_HOME/lib. (http://tomcat.apache.org/tomcat-6.0-doc/logging.html) ?
3) Modified the logging.properties in the Tomcat/conf directory?
I still keep thinking what is the right way to redirect the stdout.log? Towards the end, I just figured out that the log4j.properties is more to the application logs and to be precise, she wants Tomcat logs to be redirected. It’s still remaining a question mark for me until I went home. I’m not sure why I’m so stubborn for this question. Frankly speaking, I used to hate people that having this kind of stubbornness for certain solutions and even digging solutions at home. I used to encountered some people (especially the seniors) that are very *fill in the blanks by yourself according to your thinking* [(positive side – passion) or (negative side – stubborn)] in technical area especially if related to design pattern, architectures, which practices are better, correct standard implementation and etc. Am I getting old?
I had tested my “personal” Tomcat and just figured out that I had done a stupid thing, which is, talking to a customer more than two hours and struggling with her. Is this called “real” customer service – struggle together with your heart?
Solutions
Testing #1
I had done a testing by modifying the logging.properties in the Tomcat/conf directory:
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
I commented the second line and added this line:
1catalina.org.apache.juli.FileHandler.directory = C:/Documents and Settings/user/My Documents/log
Result:
When the Tomcat service restarted, the logs will be written into both directories: Tomcat/logs and C:/Documents and Settings/user/My Documents/logBUT
Which files in which locations?
C:/Documents and Settings/user/My Documents/log contains the following logs:
- admin..log<date>
- manager..log<date>
- catalina..log<date>
- host-manager..log<date>
- localhost..log<date>
Tomcat/logs contains the following log files:
- stdout_<date>
- stderr_<date>
- jakarta_service_<date>
Testing #2
When you start the service via Start > All Programs > Apache Tomcat 6.0 > Configure Tomcat in Windows, the Tomcat service manager allows you to configure the log levels and path in the Logging tab. You can redirect the stdout and stderror to the specific location.
Result:
Definitely, the entire log files in the specified directory.
Note: It seems people around me having “over” high technical skill. Hey team! We are thinking too much