Hi all,
after some days of trials and error .... Reading this mail archive
as many thing has been said about commons-logging in this axis-user mail
list.... I still cry for help
What I have is a web-service able to create ONE service-object
PER-USER-SESSION
(axis2 web service runs in scope=soapsession)
I need to understand logging with JULI under axis2, and
I need to be able to control the environment programmatically and
pre-condition it using logging. properties
Has someone ever used JULI - LOGGING and a logging. properties file as
shown with TOMCAT LOGGING chapters?
Also logging with JULI the default with certain tomcat implementations.
I understand that JULI logging does not give all what I want, therefore
programming is still required.
I want per user-session a log-file;
where pre- and postfix is configurable,
the users name and session id shall become part of the file
name,
and the directory path to the log file shall be configurable as
a relative path to the users home directory.
The log level of the file handler and the logger must be configurable on
a per user session basis.
And I have per session an instance of a serviced object (scope =
soapsession), threads are not my primary issue so far.
To keep it more simple:
I like to configure a logger and have file handlers assigned to it in a
properties file (see example below)
then use that logger from within my webservice code as template class,
to setup the user-session-logger and assign file-handlers with the same
attributes as the configured logger with its file handlers has.
Then if all that is done adjust the level again to the session level
demand, a parameter passed from client to this web service instance.
Here is my logging. properties file, as per tomcat logging;
this works when I expanded my HelloWorldExample servlet, where as the
servlet example was created as a sample project using NetBeans 5.5.1
#Sepps = ResourceBundle properties file - Sepp by 03.06.2009:08:38
#
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
#
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
#
org.apache.juli.FileHandler.level = ALL
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = servlet-examples.
#
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter =
java.util.logging.SimpleFormatter
#
#HelloWorldExample.handlers = org.apache.juli.FileHandler,
java.util.logging.ConsoleHandler
#HelloWorldExample.level = ALL
3HelloWorldExample.suffix = .txt
#
axawl.spezpla.servers.SpezplaService.SpServer.handlers =
org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
axawl.spezpla.servers.SpezplaService.SpServer.level = ALL
axawl.spezpla.servers.SpezplaService.SpServer.suffix = .txt
Through configuration I create an
axawl.spezpla.servers.SpezplaService.SpServer Logger and assign two
handlers to it,
then I set the loggers level to ALL (as per juli) and I define a suffix
which should become the logs file extension.
in web service code ....
private static String NameOfClassLogger =
axawl.spezpla.servers.SpezplaService.SpServer.class.getName();
private static Logger ClassLog = Logger.getLogger(NameOfClassLogger);
Handler[] hl = ClassLog.getHandlers();
// Handler[0] is juli File Handler configured
// Handler[1] is util Console Handler configured
private Handler fileHandler = null;
if (null==fileHandler) {
fileHandler = new FileHandler(MyLogPath);
fileHandler.setLevel(Level.FINEST);
fileHandler.setLevel(hl[0].getLevel());
fileHandler.setFormatter(hl[0].getFormatter());
log.addHandler(fileHandler);
}
That way I can configure programmatically my (so called)
instance-loggers and instance-handlers from configured (so called)
class/template-loggers and class/template-handlers
Is that possible using / tomcats common-logging capabilities with the
Jdk14Logger (java.util.logging) as underlaying logging system?
I would need help on:
Which JAR files need to go where and
Which JAR files are not allowed to be there (to avoid conflicts i.e
Log4j.jar, commons-logging-api.jar etc......)
I would need to know how to name and where to place this properties file
above
how declare it, that
Tomcat and or
Axis2 amd or
SpezplaService.SpServer
gets properly configured, before I need programming
I like to use the commons-logging wraper technology and then select the
Jdk124Logger system programmatically.
Any help appreciated
Josef.Stadelmann@
axa-winterthur.ch