db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Rasmussen <jrasmus...@lnxi.com>
Subject RE: Debug - Bookstore
Date Thu, 26 Feb 2004 15:04:06 GMT
Peter,

I can understand you frustration with these "[DEBUG]" messages all to
well. After reading your threads yesterday I decided to stop ignoring
the messages and tackle the issue. Here is a solution that worked for
me.

My environment: 
	Tomcat v5.0.16 Web Server
	Struts v1.1
	Torque v3.1

We first need to understand where these messages are coming from. As far
as I can tell the messages are spawned from Log4j in most of the
org.apache classes (even though my configuration of Log4j was not
complete). I have very little experience with Log4j so please take what
i say with a grain of salt :-).

1. First I removed all lines for Log4j from my Torque.properties file
(Mine is located in my WEB-INF directory of tomcat but yours could be
elsewhere).

2. Second I added the file commons-logging.properties to my
WEB-INF/classes/ directory. 
	It contains two lines:

#-------------------------------commons-logging.properties-------------------------

org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog

#-------------------------------<end>----commons-logging.properties-----------------

	(As far as i can tell this tells torque to log everything through
Log4j)

3. Third I added  the file log4j.properties to my WEB-INF/classes/
directory (I copied this from a thread so I don't quite understand it
all but it is commented well).
	You will have to edit where it says "<PATH-TO-LOGFILE>".
	It contains the following:

#-------------------------------log4j.properties-------------------------
#The set of possible levels, DEBUG, INFO, WARN, ERROR and FATAL 

# Set the root logger level to DEBUG and its only appender to rolling

log4j.rootLogger=WARN, rolling, stdout

# Set the logger level for everything under "org.apache" to WARN

log4j.logger.org.apache=WARN
log4j.logger.org.apache.torque=INFO

# Set the logger level for "org.apache.commons.validator.ValidatorUtil"
to
# FATAL because we know that errors will be generated here that we want
to
# ignore (due to the fact that it is unknown whether a consumer is
personal
# or business and the validation.xml file is not set up to accomodate
the
# differences)

log4j.logger.org.apache.commons.validator.ValidatorUtil=FATAL
log4j.logger.org.apache.log4j.TextLogger=INFO

# Configure the stdout appender to be a ConsoleAppender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender

# Configure the stdout appender to use the PatternLayout
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Configure the conversion pattern for the stdout appender
log4j.appender.stdout.layout.ConversionPattern=%d - %p %c - %m%n

# Configure the rolling appender to be a RollingFileAppender
log4j.appender.rolling=org.apache.log4j.RollingFileAppender

# Configure the name of the log file for the rolling appender
log4j.appender.rolling.File=<PATH-TO-LOGFILE>

# Configure the maximum size of the log file for the rolling appender
#log4j.appender.rolling.MaxFileSize=4MB

# Keep one backup file of the rolling appender
#log4j.appender.rolling.MaxBackupIndex=5

# Configure the rolling appender to use the PatternLayout
log4j.appender.rolling.layout=org.apache.log4j.PatternLayout

# Configure the conversion pattern for the rolling appender
log4j.appender.rolling.layout.ConversionPattern=%d - %p %c - %m%n

#-------------------------------<end>----log4j.properties-------------------------


I restarted my webapp and all my debug errors were gone. Also all errors
were now correctly sent to the tomcat console and to my log file.



I hope this helps with future logging issues.


Best of luck.

Jeff Rasmussen


BTW -- I have had my fair share of horror stories with Torque setup but
the time saved with the class generation and easily accessible
persistence layer that I will be using (and converting old projects to)
for quite some time. :-)    



On Wed, 2004-02-25 at 08:02, Peter Boheme wrote:
> >> But i think Eclipse's
> >> internal compiler compiles the Torgue generated
> >> Java classes always to "debug" class-files. This is
> >> why i got the debug-messages on my console. 
> 
> > The messages you are seeing are coming from the
> > torque logging
> > subsystem, not any special debug code. You need to
> > turn off logging in
> > an existing or new properties file.
> > 
> > Eclipse doesn't know anything about logging systems,
> > all it can do is
> > turn on/off debug info in the compilation (symbols,
> > line numbers, etc.)
> 
> Ok thx for this explanation.
> But i am not able to turn off logging ;(
> i deleted all *-properties Files except for
> torque.properties & build.properties.
> And i have no logging options in these files.
> So in which file i can configure the logging behaviour
>  ?
> 
> Pete
> 
> Pete
> 
> 
> 
> 	
> 		
> Mit schönen Grüßen von Yahoo! Mail - http://mail.yahoo.de
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message