cancel
Showing results for 
Search instead for 
Did you mean: 

log4j properties: where???

Former Member
0 Kudos

I am trying to solve some Hibernate problem, so i need the logging.

I have this properties file:


#set the level of the root logger 
log4j.rootLogger = info, file
#set logger file
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=hibernate.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%p [%t] %c{2} (%M:%L) :: %m%n
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.logger.org.hibernate=debug, file

I put this file in the web-inf/classes folder of my web project, but no logfile is made.

What must I do get the messages in a logfile?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

<b>log4j.appender.file.File=hibernate.log</b>

since you din't specify the absolute path, this will get generated in the directory where the java command is...

ideally you should specify an absolute path where the user with whose credentials the server has been started has write access.

Former Member
0 Kudos

If that is the case I should be able to find the hibernate.log file there. In my case java is in my c:\windows\system32 folder.

But it is not there. I did a search througt my whole filesystem but the file is not found.

Former Member
0 Kudos

Are you sure the configuration file is read at all?

have u specified the the log4j configuration file in ur web.xml?

<web-app id="WebApp">
	<display-name>anyApplic</display-name>
	<servlet>
		<servlet-name>Log4jInit</servlet-name>
		<display-name>Log4jInit</display-name>
		<servlet-class>de.myProject.tools.log4j.Log4jInit</servlet-class>
		<init-param>
			<param-name>log4j-init-file</param-name>
			<param-value>/WEB-INF/log4j.lcf</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>
	</servlet>