Logging#

Log4j Problem#

Q: I installed jspwiki and everything seems to work fine. But I actually have a problem with log4j The entries in the local jspwiki.properties don't seem to work. To be shure I removed the system wide log4j and its property file. This was also another version, 1.2.8. Then I started Tomcat again. No log file was created. Used existing path without typo. The following message was to be found in launcher.server.log:

log4j:ERROR No appenders could be found for category (com.ecyrd.jspwiki.WikiEngine). log4j:ERROR Please initialize the log4j system properly.

The log4j lines in jspwiki.properties log4j.appender.FileLog = org.apache.log4j.RollingFileAppender log4j.appender.FileLog.MaxFileSize = 10MB log4j.appender.FileLog.MaxBackupIndex = 14 log4j.appender.FileLog.File = d:\\webapps\\jspwiki\\_log\\jspwiki.log log4j.appender.FileLog.layout = org.apache.log4j.PatternLayout log4j.appender.FileLog.layout.ConversionPattern=%d [%t] %p %c %x - %m%n

everything else concerning log4j in jspwiki.properties is commented out. Have you got any idea, please?

After installing, I found that the first line was "log4j.appender.filelog...". Note the lowercase f and l in filelog. Also, a few lines below the appender block you should have a line starting as "log4j.rootCategory=INFO,FileLog". The FileLog should be the same as it is for the above appender lines. This resolved the problem, you mention, for me.

--JasonWester

Log4j DNS lookups taking lots of time#

Some time below, somebody complained about a terribly slowly running JSPWiki - I ran into a similar situation: after having successfully installed JSPWiki 1.8.2 within a LiteWebserver I observed long delays between an HTTP request and the corresponding response from the server (30 seconds and more) - surprisingly, the whole(!) server was blocked during that time, i.e., concurrent requests with other URIs (I'm using that server for a HTML wrapping facility based on servlets which I wrote myself) did not proceed as well!

I then figured out, that the delay might have been caused by problems with DNS lookups (the method HttpRequest.getRemoteHost took very long to complete) and switching off DNS immediately solved the problem.

Consequence: you may not have to switch off DNS resolution yourself (I just used this to verify my assumption), but you may want to change your DNS servers or help your system with a local "hosts" file...

Hoping that this remark is of any help...

--Andreas Rozek

You may be right. There should be an option to disable DNS queries (which incidentally, are currently only used by the logging routines. Duh. Perhaps I should just disable them completely.)

--JanneJalkanen

Hmmm, can I disable logging by log4j somehow? This package was the one which caused most of the trouble when installing JSPWiki on my LiteWebServer...

--Andreas Rozek

Simple: Look at the jspwiki.properties, right at the end. Comment out anything that has anything to do log4j, and you should be set. Unfortunately, since string concatenation is done before the logging, you'll still get the DNS resolution. Easiest is to remove the offending statements from the JSP pages.

--JanneJalkanen


Log4j conflict with vicaya#

I am trying to get JSPWiki to run inside of vicaya, so that a wiki that has been filled with content can be distributed on a cd. When I try to run JSPWiki through vicaya, I get this error when I start vicaya:


org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging
.LogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@12117
7e for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassD
efFoundError: org/apache/log4j/Category) (Caused by org.apache.commons.logging.L
ogConfigurationException: No suitable Log constructor [Ljava.lang.Class;@121177e
 for org.apache.commons.logging.impl.Log4JLogger (Caused by java.lang.NoClassDef
FoundError: org/apache/log4j/Category))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactory
Impl.java:543)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactory
Impl.java:235)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
        at org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:3
80)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
090)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442
)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:821)
        at net.genaud.vicaya.launch.Tomcat55.startTomcat(Tomcat55.java:144)

If I remove log4j.jar from WEB-INF/lib vicaya starts up fine, but then the wiki doesn't work -

SEVERE: Exception starting filter WikiJSPFilter
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at com.ecyrd.jspwiki.ui.WikiServletFilter.<clinit>(WikiServletFilter.jav
a:44)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Why do the logging libraries conflict? How do I fix this? Where do I even read about what is going on so maybe I can fix it? I don't know much about logging or log4j or commons-logging.

--AnonymousCoward, 25-Sep-2006

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-15) was last changed on 02-Jun-2008 12:24 by 62.177.255.42