You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Mühlethaler <ch...@freesurf.ch> on 2004/09/08 12:06:25 UTC
Re: log4j:configure [temporally solved]
It's rather off-topic, I know, but...
I could solve the issue with the multiple log entries:
A webapp should use its own log4j jar file in its WEB_INF/lib
directory, otherwise the tomcat default log4j is used.
By using the tomcat's one, whenever I restart my app a new
ConsoleAppender is created ->duplicate debug lines.
(described here:
http://jakarta.apache.org/tomcat/faq/logging.html#userWebapps)
However, I couldn't yet configure log4j from a file, even I followed
the steps from this email:
http://marc.theaimsgroup.com/?l=tomcat-user&m=108330970225012&w=2
- my config file is in WEB_INF/classes
- my code to configure log4j:
PropertyConfigurator.configure("log4jconfig.properties");
I get an error that the file couldn't be found. What do I miss?
Christian
> not sure but maybe tapesty uses log4j for its own logging so just add
> a log4j.properties file and subpress the org.apache.tapestry logger
>
>
> On 6 Sep 2004, at 14:45, Christian Mühlethaler wrote:
>
>> Hi list
>>
>> I'm working on my first tapestry webapp as a tapestry newbie.
>> It is very exciting to discover this framework, it looks really great!
>>
>> I would like to use log4j for logging. I decided to configure log4j
>> in the constructor of Global
>> as this method is the first that is called of my code (I think)
>>
>> public Global() {
>> super();
>> Layout layout = new PatternLayout("%p %c{1} %x - %m%n"); //%r
>> millisecond [%t] thread
>> Appender appender = new ConsoleAppender(layout);
>> BasicConfigurator.configure(appender);
>> log.info("Constructor");
>> }
>>
>> The strange thing is that whenever I redeploy the application (from
>> within eclipse to tomcat), every log event is written once more:
>>
>> first time
>> INFO - Constructor
>>
>> next time: (I changed the pattern slightly)
>> INFO - Constructor
>> INFO Global - Constructor
>>
>> next time:
>> INFO - Constructor
>> INFO Global - Constructor
>> 3424549 [http-8080-Processor25] INFO fh.tapestry.Global -
>>
>> etc...
>>
>>
>> My questions:
>> -Is Global the proper place for log4j configuration?
>> -It seems that the "old" appender wasn't deleted after redeploy.
>> Should I remove this appender "by hand" somehow?
>> -I created a config xml file for log4j and tried to config log4j
>> from there. However, this file couldn't be found. I tried several
>> places, my favorite one would be {contextHome}/config/log4j.xml. How
>> can I find this file? With a ContextResourceLocation? if yes, how can
>> I use it?
>>
>> Ok, not very "tapestry-under-the-hood" questions nevertheless I hope
>> to get answers!
>>
>> Thank you,
>> Christian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org