R
Richard Maher
Hi,
I need to do some logging from my Applet with varying levels of verbosity
and log4j looked like the most likely, best-of-breed, widley used, option
available for the right price. (The Applet is unsigned so a Console Appender
to System.out is all I require and have available)
So I downloaded log4j-1_2_15.jar and included it with my HTML <object> and
everything looked ok, but when the Applet loaded it was now instructing the
browser to look for a log4j.xml or log4j.conf file. I thought I was
good-to-code with the default configuration options (plus runtime
configuration of the logging level [info,debug,fatal, etc]) but I was happy
to stick a minimal XML file where the browser could find it. (See below)
What I don't like about it now is it's asking for all sorts of
infrastructure bloat to be resolved and sent down the line: -
T3$APPLET_ROOT:[000000.APPLETS.META-INF.SERVICES]
JAVAX^.XML^.PARSERS.DOCUMENTBUILDERFACTORY
T3$APPLET_ROOT:[000000.APPLETS.ORG.APACHE.LOG4J]
CONSOLEAPPENDERBEANINFO.CLASS
WRITERAPPENDERBEANINFO.CLASS
APPENDERSKELETONBEANINFO.CLASS
PATTERNLAYOUTBEANINFO.CLASS
LAYOUTBEANINFO.CLASS
T3$APPLET_ROOT:[000000.APPLETS.JAVA.LANG]
OBJECTBEANINFO.CLASS
I guess I'm asking why these classes (if needed) aren't in the JAR file
already and just home much "baggage" does log4j need?
Is there a "minimalist" switch I can set in the config, or perhaps log4j is
not the most appropriate tool after all?
Cheers Richard Maher
Minimal XML file: -
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
</layout>
</appender>
<root>
<priority value ="debug" />
<appender-ref ref="console" />
</root>
</log4j:configuration>
I need to do some logging from my Applet with varying levels of verbosity
and log4j looked like the most likely, best-of-breed, widley used, option
available for the right price. (The Applet is unsigned so a Console Appender
to System.out is all I require and have available)
So I downloaded log4j-1_2_15.jar and included it with my HTML <object> and
everything looked ok, but when the Applet loaded it was now instructing the
browser to look for a log4j.xml or log4j.conf file. I thought I was
good-to-code with the default configuration options (plus runtime
configuration of the logging level [info,debug,fatal, etc]) but I was happy
to stick a minimal XML file where the browser could find it. (See below)
What I don't like about it now is it's asking for all sorts of
infrastructure bloat to be resolved and sent down the line: -
T3$APPLET_ROOT:[000000.APPLETS.META-INF.SERVICES]
JAVAX^.XML^.PARSERS.DOCUMENTBUILDERFACTORY
T3$APPLET_ROOT:[000000.APPLETS.ORG.APACHE.LOG4J]
CONSOLEAPPENDERBEANINFO.CLASS
WRITERAPPENDERBEANINFO.CLASS
APPENDERSKELETONBEANINFO.CLASS
PATTERNLAYOUTBEANINFO.CLASS
LAYOUTBEANINFO.CLASS
T3$APPLET_ROOT:[000000.APPLETS.JAVA.LANG]
OBJECTBEANINFO.CLASS
I guess I'm asking why these classes (if needed) aren't in the JAR file
already and just home much "baggage" does log4j need?
Is there a "minimalist" switch I can set in the config, or perhaps log4j is
not the most appropriate tool after all?
Cheers Richard Maher
Minimal XML file: -
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
</layout>
</appender>
<root>
<priority value ="debug" />
<appender-ref ref="console" />
</root>
</log4j:configuration>