David,

Sorry for the very late response. I've made some changes to the maven-jetty6-plugin recently that will make it a lot easier to substitute logging at runtime.

Currently, this is only checked in to svn, but I will push a snapshot
later today.

Here's a snippet from the documentation:

"Jetty itself has no dependencies on a particular logging framework, using a built-in logger which outputs to stderr. However, to allow jetty6 to integrate with other logging mechanisms, if an http://www.slf4j.org log implementation is detected in the classpath, it will use it in preference to the built-in logger.

The JSP engine used by jetty6 does however have logging dependencies. If you are using JSP 2.0 (ie you are running in a JVM version < 1.5), the JSP engine depends on commons-logging. A default commons-logging logger will be provided by the plugin using a combination of the http://www.slf4j.org/manual.html and the http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html implementation, which logs all messages INFO level and above. You can override this and provide your own commons-logging delegated logger by using a plugin <dependency>:


     <plugin>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>maven-jetty6-plugin</artifactId>
       <configuration>
       ...
       </configuration>
       <dependencies>
         <dependency>
           <groupId>commons-logging</groupId>
           <artifactId>commons-logging</artifactId>
           <version>1.0.4</version>
         </dependency>
         <dependency>
           <groupId>log4j</groupId>
           <artifactId>log4j</artifactId>
           <version>1.2.13</version>
         </dependency>
       </dependencies>
     </plugin>


Alternatively, you can still bridge commons-logging to slf4j and just select a different SLF4J implementation by using a plugin <dependency> and providing a different slf4j implementation jar:

     <plugin>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>maven-jetty6-plugin</artifactId>
       <configuration>
       ...
       </configuration>
       <dependencies>
         <dependency>
           <groupId>org.slf4j</groupId>
           <artifactId>nlog4j</artifactId>
           <version>1.1.24</version>
         </dependency>
       </dependencies>
     </plugin>


If you are using JSP2.1 (ie you are running in a JVM >= 1.5), then the JSP engine has no particular logging dependencies."


cheers
Jan



David Main wrote:
Hello all -

Could anyone help me to understand how to change the log level that the maven-jetty6-plugin uses? I would like to put debug logging statements into my code, but then I can't seem to figure out how to get the plugin to change from its default info level. I would also like to set different logging levels on package name.

Note also that I am using the Spring framework. So first I tried using its Log4jConfigListener web util class in web.xml and pointing it at my log4j.properties file. Info messages appeared indicating that it was alive and had read my configuration:

929 [main] INFO /myapp - Initializing Log4J from [/Users/davidm/ dev/myapp/src/main/resources/webapp/WEB-INF/log4j.properties]

But no changes were evident in the logged message, neither in format nor level.

Then I found a posting on Gmane that indicated you can give Jetty your own log4j.properties file by configuring a systemProperty named "log4j.configuration", which I did in pom.xml. Again, messages indicated that Jetty recognized my property setting:

   [INFO] Property log4j.configuration=/WEB-INF/log4j.properties was  set

but nothing seemed to change the way it logs. In fact, two lines later in the log, there is this message:

2 [main] INFO org.mortbay.log - Logging to [EMAIL PROTECTED] via org.mortbay.log.Slf4jLog

Here's my (very simple) log4j.properties file:

   log4j.rootLogger=WARN, stdout

   log4j.appender.stdout=org.apache.log4j.ConsoleAppender
   log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c {1}:%L - %m%n

   log4j.logger.net.sf.hibernate=WARN
   log4j.logger.net.sf.hibernate.type=WARN
   log4j.logger.org.springframework=WARN

I read Jetty's tutorial on logging, but it :
http://www.mortbay.org/jetty/tut/logging.html

Finally, I gave the "-DDEBUG" and "-DDEBUG_PATTERNS=net.sf.hibernate" a shot, but these too seemed to be ignored.

I get the feeling that I am clashing somehow with Jetty's own logging. Can anyone help me unravel this?

Thanks
--David


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to