tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Diego Doval" <di...@mindstech.com>
Subject additional logging features -- proposal
Date Wed, 14 Jun 2000 22:28:13 GMT
Hi Everyone,

	I'm new to the development list, so apologies in advance for any possible
errors/misunderstandings on my part. ;-)

	I've made a couple of small changes to tomcat (on the latest sources, dates
June 14), and I would like to contribute them to the project. I am including
the changes in this email with an explanation, and if people find them
useful hopefully they will get included in the tomcat distribution.

	The changes have to do with logging and are fairly simple:

	1) Added a tomcat startup option (to Tomcat.java) to recognize the
parameters "-logfile" and "-datelogfile".
	-logfile "file.log" redirects stderr and stdout to file.log
	-datelogfile redirects stderr and stdout to file.log but it adds the
current date and time to the file name (between the filename and the
extension) to allow for different logfiles for different startup times.

	The rationale behind this change is that when running the JVM as a service
(using ServiceInstaller for example) the shell is not parsing the command
line so parameters such as
"2>err.txt" don't work, they are just received by tomcat, who ignores them.

	2) Added an option to the Logger tag in server.xml called "useDate"

	For example

    <Logger name="tc_log"
            customOutput="yes"
                useDate="true"
         path="logs/tomcat.log" />

	useDate=true means that logs are not overwritten at startup since the name
includes the log creation date. We have found this useful for some cases.
Another alternative for this would be to add an option so logs are never
overwritten and there is a clear separation at the beginning of each line.

	The files I modified are

	src\share\org\apache\tomcat\logging\Logger.java
			(where I added setUseDate(), getUseDate() and modified the open() method)
	src\share\org\apache\tomcat\startup\Tomcat.java
			(where I modified the processArgs() method)
	src\share\org\apache\tomcat\util\FileUtil.java
			(where I added the addCurrentDateToPath() method, which is used for both
features)

	I have included the modified files as an attachment with this email.

	Any feedback would be greatly appreciated. Also, if there is a better way
of solving these problems and all this is unnecessary, please let me know.

	thanks!

	diego

Mime
View raw message