You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Rafal Markut <ra...@mediawave.de> on 2006/04/27 13:45:15 UTC

Log4j doesn't create log files

Hello,

I use Turbine 2.3.2 with Torque 3.1.1.
In that turbine there is log4j-1.2.12.jar.

It doesn't create on my linux server the log files (e.g. turbine.log).

This same application I have on windows and everything works fine.

My linux server and windows are using Tomcat 5.x

In TurbineResources.properties:

log4j.file = /WEB-INF/conf/log4j.properties



In log4j.properties

# ------------------------------------------------------------------------
#
# Logging Configuration
#
# $Id: log4j.properties,v 1.1 2006/03/30 14:35:01 rmarkut Exp $
#
# ------------------------------------------------------------------------

#
# If we don't know the logging facility, put it into the
# turbine.log
#
log4j.rootLogger = INFO, app

#
# Turbine goes into Turbine Log
#
log4j.category.org.apache.turbine = INFO, turbine
log4j.additivity.org.apache.turbine = false

#
# Torque has its own log file
#
log4j.category.org.apache.torque = INFO, torque
log4j.additivity.org.apache.torque = false

#
# Velocity Logfile
#
log4j.category.velocity = INFO, velocity
log4j.additivity.velocity = false

#
# Scheduler Category
#
log4j.category.scheduler = INFO, scheduler
log4j.additivity.scheduler = false

#
# Avalon Logfile
#
log4j.category.avalon = INFO, avalon
log4j.additivity.avalon = false

########################################################################
#
# Logfile definitions
#
########################################################################

#
# turbine.log
#
log4j.appender.turbine = org.apache.log4j.FileAppender
log4j.appender.turbine.file = ${applicationRoot}/logs/turbine.log
log4j.appender.turbine.layout = org.apache.log4j.PatternLayout
log4j.appender.turbine.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.turbine.append = false

#
# torque.log
# 
log4j.appender.torque = org.apache.log4j.FileAppender
log4j.appender.torque.file = ${applicationRoot}/logs/torque.log
log4j.appender.torque.layout = org.apache.log4j.PatternLayout
log4j.appender.torque.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.torque.append = false

#
# Scheduler Output
#
log4j.appender.scheduler = org.apache.log4j.FileAppender
log4j.appender.scheduler.file = ${applicationRoot}/logs/scheduler.log
log4j.appender.scheduler.layout = org.apache.log4j.PatternLayout
log4j.appender.scheduler.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.scheduler.append = false

#
# Velocity gets configured to write its output onto the velocity
# category.
#
log4j.appender.velocity = org.apache.log4j.FileAppender
log4j.appender.velocity.file = ${applicationRoot}/logs/velocity.log
log4j.appender.velocity.layout = org.apache.log4j.PatternLayout
log4j.appender.velocity.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.velocity.append = false

#
# Avalon gets configured to write its output onto the avalon
# category.
#
log4j.appender.avalon = org.apache.log4j.FileAppender
log4j.appender.avalon.file = ${applicationRoot}/logs/avalon.log
log4j.appender.avalon.layout = org.apache.log4j.PatternLayout
log4j.appender.avalon.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.avalon.append = false

#
# Application.log
#
log4j.appender.app = org.apache.log4j.FileAppender
log4j.appender.app.file = ${applicationRoot}/logs/application.log
log4j.appender.app.layout = org.apache.log4j.PatternLayout
log4j.appender.app.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.app.append = false

Any ideas ? Did somebody has such problem before ?

Thank you for help in advance.

with best regads,
Rafal

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


Re: Log4j doesn't create log files

Posted by Rafal Markut <ra...@mediawave.de>.
Hi,

I solved my problem.

I had: log4j.appender.*.file=${applicationRoot}/logs/*.log
but when I made:
log4j.appender.*.file=/usr/share/tomcat/webapps/firstsyst/logs/*.log
then it works.

Why is the variable ${applicationRoot}not set ?

with best regards,
Rafal

----- Original Message ----- 
From: "Shane Beasley" <sb...@acm.org>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Thursday, April 27, 2006 10:55 PM
Subject: Re: Log4j doesn't create log files


> Rafal Markut wrote:
> 
>>  I use Turbine 2.3.2 with Torque 3.1.1. In that turbine there is
>>  log4j-1.2.12.jar.
>>
>>  It doesn't create on my linux server the log files (e.g.
>>  turbine.log).
> 
> First, check your Tomcat log files (e.g. $CATALINA_HOME/logs). It might 
> have some useful information about the cause.
> 
> This particular problem has happened to me before, for two unrelated 
> reasons.
> 
> I. UNIX FILE PERMISSIONS
> 
> Likely, Tomcat runs under a particular user account. Make sure that the 
> operating system will allow that account to create the logs by doing 
> EITHER of the following:
> 
> - grant +rwx access on $CATALINA_HOME/webapps/MyWebApp
> - create and grant +rwx access on $CATALINA_HOME/webapps/MyWebApp/logs
> 
> The latter is better because it restricts access to the "logs" directory 
> only. However, on a development machine, the former might be acceptable.
> 
> II. JAVA SECURITY MANAGER
> 
> It may be that the Java Security Manager is stopping you. At the 
> minimum, you'll need the following in your policy file (e.g. 
> $CATALINA_HOME/conf/catalina.policy):
> 
> grant codeBase "file:${catalina.home}/webapps/MyWebApp/-" {
>  permission java.io.FilePermission 
> "${catalina.home}/webapps/industryinforespdb/logs", "write";
>  permission java.io.FilePermission 
> "${catalina.home}/webapps/industryinforespdb/logs/-", "write";
> };
> 
> I've found that if it forbids you from creating the log files, it might 
> forbid you from doing other things as well. There are numerous ways to 
> fix those. You might find this to be helpful in that endeavor:
> 
> http://www.oreilly.com/catalog/javasec2/chapter/ch01.html
> 
> Note: Adding "-Djava.security.debug=all" to the Tomcat startup command 
> will add tons of useful diagnostics to your logs, which you can use to 
> hunt down permissions problems on a case-by-case basis.
> 
> Shane

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


Re: Log4j doesn't create log files

Posted by Shane Beasley <sb...@acm.org>.
Rafal Markut wrote:

>  I use Turbine 2.3.2 with Torque 3.1.1. In that turbine there is
>  log4j-1.2.12.jar.
>
>  It doesn't create on my linux server the log files (e.g.
>  turbine.log).

First, check your Tomcat log files (e.g. $CATALINA_HOME/logs). It might 
have some useful information about the cause.

This particular problem has happened to me before, for two unrelated 
reasons.

I. UNIX FILE PERMISSIONS

Likely, Tomcat runs under a particular user account. Make sure that the 
operating system will allow that account to create the logs by doing 
EITHER of the following:

- grant +rwx access on $CATALINA_HOME/webapps/MyWebApp
- create and grant +rwx access on $CATALINA_HOME/webapps/MyWebApp/logs

The latter is better because it restricts access to the "logs" directory 
only. However, on a development machine, the former might be acceptable.

II. JAVA SECURITY MANAGER

It may be that the Java Security Manager is stopping you. At the 
minimum, you'll need the following in your policy file (e.g. 
$CATALINA_HOME/conf/catalina.policy):

grant codeBase "file:${catalina.home}/webapps/MyWebApp/-" {
  permission java.io.FilePermission 
"${catalina.home}/webapps/industryinforespdb/logs", "write";
  permission java.io.FilePermission 
"${catalina.home}/webapps/industryinforespdb/logs/-", "write";
};

I've found that if it forbids you from creating the log files, it might 
forbid you from doing other things as well. There are numerous ways to 
fix those. You might find this to be helpful in that endeavor:

http://www.oreilly.com/catalog/javasec2/chapter/ch01.html

Note: Adding "-Djava.security.debug=all" to the Tomcat startup command 
will add tons of useful diagnostics to your logs, which you can use to 
hunt down permissions problems on a case-by-case basis.

Shane

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