tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Langjahr, Uwe" <uwe.langj...@hp.com>
Subject Own logging formatter in webapps
Date Thu, 04 Jan 2007 18:15:55 GMT
Hello together,

I'm a newbie using Java/Tomcat/JSF-MyFaces all together.
Can somebody help me, I have problems with the logging mechanism.


- I want to use the JDK logging mechanism in my webapp.
- I want to use my own class uxspiweb.log.DebugFormatter for the
ConsoleHandler channel.
- I put the following content in
UXSPI-WEB/WEB-INF/classes/logging.properties
---------
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = UXSPIWEB.
java.util.logging.ConsoleHandler.level = FINEST
# Want to use OWN Formatter
java.util.logging.ConsoleHandler.formatter = uxspiweb.log.DebugFormatter
---------
- DebugFormatter is available in
"webapps/UXSPI-WEB/WEB-INF/classes/uxspiweb/log/DebugFormatter.class"
- The class uxspiweb.log.DebugFormatter is working well with
"standalone" applications.
- In the webapp  (JSF) I'm use the following class
---------
  <managed-bean>
    <managed-bean-name>treeCtrl</managed-bean-name>
    <managed-bean-class>
      uxspiweb.TreeController
    </managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
---------
- In the uxspi.TreeController I'm using the following code snippet:
---------
      package uxspi;
      import ....;
	static private Logger logger =
Logger.getLogger(TreeController.class.getName());
	public TreeController () {

		logger.info ("Program started");
		logger.info ("Log:" + logger.getClass());
            ....
---------

- The class DebugFormatter is NOT used/found/applied/accessable?
- Other classes from the webapps don't have any problem.
- BUT I belief, that the UXSPI-WEB/WEB-INF/classes/logging.properties is
"evaluated", because
  the following entry "org.apache.juli.FileHandler.prefix = UXSPIWEB."
is active.
  If I modify this entry, another logfile is created.
- I also have tried things like this: (in the class TreeController)
---------
	static {
		String logConfig =
"./webapps/UXSPI-WEB/WEB-INF/classes/logging.properties";
//		String logConfig = "WEB-INF/classes/logging.properties";
		System.setProperty("java.util.logging.config.file",
logConfig);
	      System.out.println("ConfigFile: " +
System.getProperty("java.util.logging.config.file"));
		System.out.println(
System.getProperties().toString().replace( ',', '\n' )
             .replace( '{', ' '  )
             .replace( '}', ' '  ) );

--> in the log I see the property is set.
---------
- I don't have found any information/errors about DebugFormatter in the
logs from tomcat.

Any ideas?

Uwe

Environment:
JDK 1.5.0_06-b05
Tomcat 5.5.16
Windows XP


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message