Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

logj4 config

Posted on 2006-06-16
4
Medium Priority
?
409 Views
Last Modified: 2011-04-14
Hi,

How do i setup  logj4 config for my jsp project so that i can write to catalina.out from the jsp project?

0
Comment
Question by:komlaaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Tol_cv
ID: 16919330
Hi,
everthing sended to   console is written in catalina.out.

log4j.properties configuration file:


log4j.debug=true

log4j.rootLogger=DEBUG, CONSOLE #  your log level ... that will write  all logs in catalina

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.CONSOLE.layout.ConversionPattern=%c %-5p %d [%t] - %m%n


or  in  xml configuration:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
    </layout>
  </appender>
 <root>
    <priority value ="debug" />
    <appender-ref ref="console" />
  </root>
 
</log4j:configuration>

a useful link http://logging.apache.org/log4j/docs/manual.html ( it describes how can you configurate log4j for tomcat etc).

 

0
 

Author Comment

by:komlaaa
ID: 16920790
but don't see how this bound with a specifica webapp
0
 
LVL 4

Accepted Solution

by:
Tol_cv earned 1000 total points
ID: 16921014

 to bound with a specific application.
put log4j.properties under /webapps/<application>/classes

http://www.onjava.com/pub/a/onjava/2002/08/07/log4j.html?page=1
0
 
LVL 3

Expert Comment

by:ss_p
ID: 16992804
you have to put the log4j.properties file in WEB-INF/classes folder.

When the server starts,

It loads all the classes in classes folder, and if log4.properties file is present in classes folder. The log4j property gets set for that particular appliaction.
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
As much as Microsoft wants to kill off PST file support, just as they tried to do with public folders, there are still times when it is useful or downright necessary to export Exchange mailboxes to PST files. Thankfully, it is still possible to e…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question