You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2012/02/01 15:32:01 UTC

DO NOT REPLY [Bug 42189] Add simple bridge for java.util.logging, with basic Configurator support

https://issues.apache.org/bugzilla/show_bug.cgi?id=42189

--- Comment #19 from Emmanuel Bourg <eb...@apache.org> 2012-02-01 14:32:01 UTC ---
Is there any updates on this topic? Is help needed? I have been using this
component for quite some time now, most notably as a mean to nicely format the
JUL messages in my test cases without touching the code. An official release in
the central Maven repository, either as an independent component or as part of
the core distribution, would be very welcome.

For the record here is how I use the bridge to format the log messages in my
tests, in the Maven POM I put this:

  <dependencies>
    <dependency>
      <groupId>org.apache.logging</groupId>
      <artifactId>apache-jul-log4j-bridge</artifactId>
      <version>1.0.0-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.16</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
      <systemProperties>
        <property>
          <name>java.util.logging.manager</name>
          <value>org.apache.logging.julbridge.JULBridgeLogManager</value>
        </property>
        <property>
          <name>log4j.configuration</name>
          <value>log4j.properties</value>
        </property>
      </systemProperties>
    </configuration>
  </plugin>

  <plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <phase>generate-test-sources</phase>
        <goals><goal>run</goal></goals>
        <configuration>
          <tasks>
            <mkdir dir="target/test-classes"/>
            <echo file="target/test-classes/log4j.properties">
# log4j configuration for test cases
log4j.rootLogger=INFO, console
log4j.logger.com.arianesoftware=INFO

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=[%d{HH:mm:ss}] [%p] %x %m%n
            </echo>
          </tasks>
        </configuration>
      </execution>
    </executions>
  </plugin>

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org