Solved

logj4 config

Posted on 2006-06-16
4
380 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
  • 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 250 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Apache-Tomcat Single Sign On with NTLM/Kerberos on Windows 2008R2 3 214
java beans and EJBs 5 192
Java Script nested call 3 86
designing in object programming 12 77
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
For months I had no idea how to 'discover' the IP address of the other end of a link (without asking someone who knows), and it drove me batty. Think about it. You can't use Cisco Discovery Protocol (CDP) because it's not implemented on the ASAs.…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 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