Wednesday, January 28, 2015

Log4j GWT Problem

Hello,
I have a problem with Log4j GWT:

[INFO] create exploded Jetty webapp in C: \ Users \ Łukasz \ workspace \ WebSKS \ target \ WebSKS-1.0-SNAPSHOT
[INFO] auto discovered modules [pl.cba.lukaszbaczek.webSKS]
[ERROR] log4j: WARN No appenders could be found for logger (org.eclipse.jetty.util.log).
[ERROR] log4j: WARN Please initialize the log4j system properly.
[ERROR] log4j: WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[ERROR] log4j: WARN No appenders could be found for logger (org.apache.jasper.compiler.JspRuntimeContext).
[ERROR] log4j: WARN Please initialize the log4j system properly.
[ERROR] log4j: WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

My Log4j configuration looks like this:

1. Log4j.properties:

# LOG4J configuration
log4j.rootLogger = DEBUG, Appender1
 
log4j.appender.Appender1 = org.apache.log4j.ConsoleAppender
log4j.appender.Appender1.layout = org.apache.log4j.PatternLayout
log4j.appender.Appender1.layout.ConversionPattern =% - 7p% d [% t]% c% x -% m% n

2. that indicates where the file is stored configuration:

pl.cba.lukaszbaczek.server package;

import java.io.File;

javax.servlet.ServletContext import;
javax.servlet.ServletContextEvent import;
javax.servlet.ServletContextListener import;

org.apache.log4j.PropertyConfigurator import;

public class implements ServletContextListener {ContextListener

Override
public void contextDestroyed (ServletContextEvent arg0) {
}

Override
public void contextInitialized (ServletContextEvent arg0) {
ServletContext context = arg0.getServletContext ();
String log4jConfigFile = context
.getInitParameter ("log4j-config-location");
Context.getRealPath fullpath = String ("") + File.separator
+ Log4jConfigFile;

PropertyConfigurator.configure (fullpath);
}

}


That is my web.xml:

<? xml version = "1.0" encoding = "UTF-8"?>
<web-app version = "3.0" xmlns = "http://java.sun.com/xml/ns/javaee"
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/web-app_3_0.xsd">
     <session-config>
         <session-timeout>
             30
         </ session-timeout>
     </ session-config>
    
      <context-param>
         <param-name> log4j-config-location </ param-name>
         <param-value> WEB-INF / log4j.properties </ param-value>
     </ context-param>
      
    <listener>
     <listener-class> pl.cba.lukaszbaczek.server.ContextListener </ listener-class>
    </ listener>
   
     <listener>
         <listener-class> pl.cba.lukaszbaczek.server.GuiceServletDispatchConfig </ listener-class>
     </ listener>
      
     <filter>
         <filter-name> guiceFilter </ filter-name>
         <filter-class> com.google.inject.servlet.GuiceFilter </ filter-class>
     </ filter>

     <filter-mapping>
         <filter-name> guiceFilter </ filter-name>
         <url-pattern> / * </ url-pattern>
     </ filter-mapping>
</ web-app>


Here a link so that you could see where it stores log4j.properties:
https://drive.google.com/file/d/0B919uo76vaP1QjZHam41dU1jQTA/view?usp=sharing

My GWT 2.6.0

No comments:

Post a Comment