[logback-user] Logback and WebLogic Server 11gR1 10.3.4

Davide Castellano davidecastellano at hotmail.it
Tue Mar 4 15:34:18 CET 2014


TO THE MODERATOR: I'm sorry if I'm submitting for the second time the same messge, but the previous one was really bad formatted, hope this one would be readable.

After many attempts I can't print the log to a file.

- Result on STDOUT:

 <3-mar-2014 13.10.53 CET> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>
 0    [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN  it.foo  - I love programming.
 0    [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR it.foo  - I am programming.

 The file MyLog.log is still not written.

- This is what I've done:
****************************
ListMan.ear
 |
 -\META-INF
  |
  - weblogic-application.xml
  - logback.xml
 - ConsoleAmministr.war
  |
  - \WEB-INF
   |
   weblogic.xml
   logback.xml
   |
   - \lib
    |
    - logback-classic-1.1.1.jar
    - logback-core-1.1.1.jar
    - slf4j-api-1.7.6.jar
   - \classes
    |
    logback.xml
    - \it
     |
     - foo.java
    - \resource
     |
     - logback.xml

***********************************************************
logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>MyLog.log</file>
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
 </appender>
  
  <logger name="it" level="TRACE"/>
 
  <root level="debug">
    <appender-ref ref="FILE" />
  </root>
</configuration>
***********************************************************
foo.java:

...
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
 static final Logger LOG = LoggerFactory.getLogger(foo.class);
...
 LOG.info("I am fine.");
 LOG.warn("I love programming.");
 LOG.error("I am programming.");
...
***********************************************************
weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">
  <jsp-descriptor>
    <keepgenerated>true</keepgenerated>
  </jsp-descriptor>
  <context-root>/ConsoleAmministr</context-root>
  <weblogic-version>10.3.5</weblogic-version>
  <container-descriptor>
   <prefer-application-packages>
     <package-name>org.slf4j</package-name>
   </prefer-application-packages>
  </container-descriptor>
</weblogic-web-app>
***********************************************************
weblogic-application.xml:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
    <prefer-application-packages>
        <package-name>org.slf4j.*</package-name>
        <package-name>antlr.*</package-name>
    </prefer-application-packages>
    
    <prefer-application-resources>
        <resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
    </prefer-application-resources>    
    
</weblogic-application>
***********************************************************

Thanks in advance for your help,
 Dave 		 	   		  


More information about the Logback-user mailing list