Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat Cannot Find log4j.properties file

Reply
Thread Tools

Tomcat Cannot Find log4j.properties file

 
 
John
Guest
Posts: n/a
 
      07-19-2004
I am trying to install log4j into an existing web app. However, when I
debug it seem that the ligger is using ConsoleAppender instead of
RollingFileAppender.

I am guessing that it is not finding the log4j.properties file.

Any ideas?

-----
log4j.properties:

# Sample properties to initialize log4j
log4j.rootCategory=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppen der
log4j.appender.R.File=./regreporting.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=2
log4j.appender.R.layout=org.apache.log4j.PatternLa yout
log4j.appender.R.layout.ConversionPattern=%p %d %c - %m%n


---
java file:

import org.apache.log4j.Logger;

public class RegRptTaskSpecInitAction extends Action {

private static Logger logger =
Logger.getLogger(RegRptTaskSpecInitAction.class.ge tName());

......
public void getValue(){
logger.debug("*****TEST THIS TODAY");
}
}
 
Reply With Quote
 
 
 
 
Juha Laiho
Guest
Posts: n/a
 
      07-20-2004
(John) said:
>I am trying to install log4j into an existing web app. However, when I
>debug it seem that the ligger is using ConsoleAppender instead of
>RollingFileAppender.
>
>I am guessing that it is not finding the log4j.properties file.


If you can, restart Tomcat so that the system property log4j.debug is set
to true. This will cause log4j to emit internal logging information into
Tomcats logs.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
Reply With Quote
 
 
 
 
Andrea Spinelli
Guest
Posts: n/a
 
      07-20-2004
(John) wrote in news:27212259.0407190733.a1a73f3
@posting.google.com:

> I am trying to install log4j into an existing web app. However, when I
> debug it seem that the ligger is using ConsoleAppender instead of
> RollingFileAppender.
>
> I am guessing that it is not finding the log4j.properties file.


Sorry if this is too stupid, but where have you put the log4j.properties?

The most common solution is in <your-app>/WEB-INF/classes/

The documentation state that it is easy and works, and
I confirm this statement.

Other choices are possible, but less common.

Moreover, you miss the log4.rootLogger:

> # Sample properties to initialize log4j
> log4j.rootCategory=debug, R

should be, AFAIK,

log4j.rootLogger=DEBUG, R

(maybe yous is good, but i can swear only about mine!)

My two cents...

--
Andrea Spinelli - IT&T srl
Via Sigismondi, 40 - 24018 Villa d'Alme' (BG)
tel: +39+035636029 - fax: +39+035638129
http://www.imteam.it/
 
Reply With Quote
 
Josh
Guest
Posts: n/a
 
      07-20-2004
It may be the ./ you're using to locate the file. The present
directory may not be where you're assuming it is. Instead, I'd use a
full path. As an FYI, you can also use system variables:

log4j.appender.R.File=${catalina.home}/webapps/yourapp/dir/regreporting.log
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot upgrade Google Earth cannot find {18D3ED9E-183C-4C00-B333-FB0C2FAE8B0F} joewo Computer Support 3 10-09-2007 05:23 AM
usebean not working, Tomcat saying cannot find class Nawab Java 0 02-19-2004 12:45 AM
Tomcat can't find log4j properties file in war file Jim Java 0 01-19-2004 06:33 PM
Browser cannot find any server anymore after 5 minutes of normal activity (" The page cannot be displayed ") reply@newsgroup.please Computer Support 6 01-05-2004 04:03 AM
The file 'bin\WebProj.dll' cannot be copied to the run directory. The requested operation cannot be performed on a file with a user-mapped section open. J Gao ASP .Net 0 07-28-2003 04:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57