How to get log4j work in Jetty4.2.24

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get log4j work in Jetty4.2.24

David Chen-6
Hi, there:
 
After using Jetty4.2.24, we have some issues on log4j. Our web applications are using log4j for logs. Read the tutorial, so, I did following steps:
 
a. moved log4j.jar from webapplication WEB-INF\lib to ext directory;
b. run: java -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger -jar start.jar etc\jetty.xml
 
It gives me the warning:
log4j:WARN No appenders could be found for logger (com.xyz.myproject.web.Main).
log4j:WARN Please initialize the log4j system properly.
 
 
my questions:
a. should I use log4j.properties or log4j.xml or either one will work in Jetty4.2.24?
b. currently I put log4j.xml in C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct?
 
Highly appreciated if any suggestions
 
Thanks a lot
 
David
 
Here are my log4j.xml for your reference:
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
 
 
  <!-- ============================== -->
  <!-- Append messages to the console -->
  <!-- ============================== -->
  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
    <param name="Threshold" value="TRACE"/>
    <param name="Target" value="System.err"/>
 
    <layout class="org.apache.log4j.PatternLayout">
      <!-- The default pattern: Date Priority [Category] Message\n -->
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
    </layout>
  </appender>
 
  <appender name="FILE" class="org.apache.log4j.FileAppender">
    <param name="Threshold" value="INFO"/>
    <param name="File" value="${jetty.home}/logs/WebBooker.log"/>
 
    <layout class="org.apache.log4j.PatternLayout">
      <!-- The default pattern: Date Priority [Category] Message\n -->
      <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
    </layout>
 </appender>
 
 
  <root>
    <appender-ref ref="CONSOLE"/>
    <appender-ref ref="FILE"/>
  </root>
 
</log4j:configuration>
Reply | Threaded
Open this post in threaded view
|

Re: How to get log4j work in Jetty4.2.24

jan_bartel
David,

AFAIK, you have to tell log4j where to find it's configuration file.
So you have to use something like:

-Dlog4j.configuration=log4j.xml

Where log4j.xml has to be on the classpath, by which I mean the same
classpath as the log4j.jar. So try copying the log4j.xml file into
the /ext directory.

regards
Jan

David Chen wrote:

> Hi, there:
>  
> After using Jetty4.2.24, we have some issues on log4j. Our web
> applications are using log4j for logs. Read the tutorial, so, I did
> following steps:
>  
> a. moved log4j.jar from webapplication WEB-INF\lib to ext directory;
> b. run: java
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> -jar start.jar etc\jetty.xml
>  
> It gives me the warning:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
>  
>  
> my questions:
> a. should I use log4j.properties or log4j.xml or either one will work in
> Jetty4.2.24?
> b. currently I put log4j.xml in
> C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct?
>  
> Highly appreciated if any suggestions
>  
> Thanks a lot
>  
> David
>  
> Here are my log4j.xml for your reference:
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
> debug="false">
>  
>  
>   <!-- ============================== -->
>   <!-- Append messages to the console -->
>   <!-- ============================== -->
>   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>     <param name="Threshold" value="TRACE"/>
>     <param name="Target" value="System.err"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>   </appender>
>  
>   <appender name="FILE" class="org.apache.log4j.FileAppender">
>     <param name="Threshold" value="INFO"/>
>     <param name="File" value="${jetty.home}/logs/WebBooker.log"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>  </appender>
>  
>  
>   <root>
>     <appender-ref ref="CONSOLE"/>
>     <appender-ref ref="FILE"/>
>   </root>
>  
> </log4j:configuration>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

David Chen-6
In reply to this post by David Chen-6
Hi, Jan:

Thank you very much for the reply. I followed what you said: a. moved
log4j.xml to ext directory; b. run jetty as:
java
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
-Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml

However, I still got that problem:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
And the log file is not even created. Is there any problem in my log4j.xml?

Thanks a lot
David
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Tuesday, July 19, 2005 4:23 AM
To: [hidden email]
Subject: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24

David,

AFAIK, you have to tell log4j where to find it's configuration file.
So you have to use something like:

-Dlog4j.configuration=log4j.xml

Where log4j.xml has to be on the classpath, by which I mean the same
classpath as the log4j.jar. So try copying the log4j.xml file into the /ext
directory.

regards
Jan

David Chen wrote:

> Hi, there:
>  
> After using Jetty4.2.24, we have some issues on log4j. Our web
> applications are using log4j for logs. Read the tutorial, so, I did
> following steps:
>  
> a. moved log4j.jar from webapplication WEB-INF\lib to ext directory;
> b. run: java
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J
> Logger
> -jar start.jar etc\jetty.xml
>  
> It gives me the warning:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
>  
>  
> my questions:
> a. should I use log4j.properties or log4j.xml or either one will work
> in Jetty4.2.24?
> b. currently I put log4j.xml in
> C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct?
>  
> Highly appreciated if any suggestions
>  
> Thanks a lot
>  
> David
>  
> Here are my log4j.xml for your reference:
>  
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration
> SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
> debug="false">
>  
>  
>   <!-- ============================== -->
>   <!-- Append messages to the console -->
>   <!-- ============================== -->
>   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>     <param name="Threshold" value="TRACE"/>
>     <param name="Target" value="System.err"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>   </appender>
>  
>   <appender name="FILE" class="org.apache.log4j.FileAppender">
>     <param name="Threshold" value="INFO"/>
>     <param name="File" value="${jetty.home}/logs/WebBooker.log"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>  </appender>
>  
>  
>   <root>
>     <appender-ref ref="CONSOLE"/>
>     <appender-ref ref="FILE"/>
>   </root>
>  
> </log4j:configuration>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
IBM. Find simple to follow Roadmaps, straightforward articles, informative
Webcasts and more! Get everything you need to get up to speed, fast.
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

David Chen-6
In reply to this post by David Chen-6
Hi, there:

Just follow up my previous email. If I unzip Jetty4.2.24-all package, after
deploying my webapplications on its webapps directory, I did see everything
is logged in logs\log4jetty.log, which means it takes
extra\plus\resources\log4j.xml as log4j.configuration. However, if I unzip
Jetty4.2.24.tar, and just copied the same log4j.xml and log4j.jar to ext\
directory, and run jetty as:
Java
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
-Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
Jetty gives me warning as:
log4j:WARN No appenders could be found for logger
(com.xyz.myproject.web.Main).
log4j:WARN Please initialize the log4j system properly.
And no log file is created, nothing is logged correctly.

Highly appreciated if anyone can help me on that issue. Thanks a lot in
advance.

David

 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Tuesday, July 19, 2005 9:20 AM
To: [hidden email]
Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24

Hi, Jan:

Thank you very much for the reply. I followed what you said: a. moved
log4j.xml to ext directory; b. run jetty as:
java
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
-Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml

However, I still got that problem:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
And the log file is not even created. Is there any problem in my log4j.xml?

Thanks a lot
David
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Tuesday, July 19, 2005 4:23 AM
To: [hidden email]
Subject: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24

David,

AFAIK, you have to tell log4j where to find it's configuration file.
So you have to use something like:

-Dlog4j.configuration=log4j.xml

Where log4j.xml has to be on the classpath, by which I mean the same
classpath as the log4j.jar. So try copying the log4j.xml file into the /ext
directory.

regards
Jan

David Chen wrote:

> Hi, there:
>  
> After using Jetty4.2.24, we have some issues on log4j. Our web
> applications are using log4j for logs. Read the tutorial, so, I did
> following steps:
>  
> a. moved log4j.jar from webapplication WEB-INF\lib to ext directory;
> b. run: java
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J
> Logger
> -jar start.jar etc\jetty.xml
>  
> It gives me the warning:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
>  
>  
> my questions:
> a. should I use log4j.properties or log4j.xml or either one will work
> in Jetty4.2.24?
> b. currently I put log4j.xml in
> C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct?
>  
> Highly appreciated if any suggestions
>  
> Thanks a lot
>  
> David
>  
> Here are my log4j.xml for your reference:
>  
> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration
> SYSTEM "log4j.dtd">
>
> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
> debug="false">
>  
>  
>   <!-- ============================== -->
>   <!-- Append messages to the console -->
>   <!-- ============================== -->
>   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
>     <param name="Threshold" value="TRACE"/>
>     <param name="Target" value="System.err"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>   </appender>
>  
>   <appender name="FILE" class="org.apache.log4j.FileAppender">
>     <param name="Threshold" value="INFO"/>
>     <param name="File" value="${jetty.home}/logs/WebBooker.log"/>
>  
>     <layout class="org.apache.log4j.PatternLayout">
>       <!-- The default pattern: Date Priority [Category] Message\n -->
>       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> %m%n"/>
>     </layout>
>  </appender>
>  
>  
>   <root>
>     <appender-ref ref="CONSOLE"/>
>     <appender-ref ref="FILE"/>
>   </root>
>  
> </log4j:configuration>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
IBM. Find simple to follow Roadmaps, straightforward articles, informative
Webcasts and more! Get everything you need to get up to speed, fast.
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
IBM. Find simple to follow Roadmaps, straightforward articles, informative
Webcasts and more! Get everything you need to get up to speed, fast.
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

Ceki Gulcu-2
In reply to this post by David Chen-6
Hello,

The -Dlog4j.configuration=log4j.xml directive is redundant because log4j
will default to searching for log4j.xml file before log4j.properties.

For mire information about what log4j is doing, I'd highly recommend that
you try the log4j.debug directive as in

java -Dlog4j.debug ... etc.

I hope this helps,

At 06:19 PM 7/19/2005, David Chen wrote:

>Hi, Jan:
>
>Thank you very much for the reply. I followed what you said: a. moved
>log4j.xml to ext directory; b. run jetty as:
>java
>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
>-Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
>
>However, I still got that problem:
> > log4j:WARN No appenders could be found for logger
> > (com.xyz.myproject.web.Main).
> > log4j:WARN Please initialize the log4j system properly.
>And the log file is not even created. Is there any problem in my log4j.xml?
>
>Thanks a lot
>David
>

--
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

David Chen-6
In reply to this post by David Chen-6
Thank you very much Ceki. It's my mistake, Jetty seems can not find
ext/log4j.xml, so, either move log4j.xml to root directory, or using
-Dlog4j.configuration=ext\log4j.xml will work.

Thanks a lot

David

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Tuesday, July 19, 2005 9:53 AM
To: [hidden email]
Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24

Hello,

The -Dlog4j.configuration=log4j.xml directive is redundant because log4j
will default to searching for log4j.xml file before log4j.properties.

For mire information about what log4j is doing, I'd highly recommend that
you try the log4j.debug directive as in

java -Dlog4j.debug ... etc.

I hope this helps,

At 06:19 PM 7/19/2005, David Chen wrote:

>Hi, Jan:
>
>Thank you very much for the reply. I followed what you said: a. moved
>log4j.xml to ext directory; b. run jetty as:
>java
>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
>ogger -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
>
>However, I still got that problem:
> > log4j:WARN No appenders could be found for logger
> > (com.xyz.myproject.web.Main).
> > log4j:WARN Please initialize the log4j system properly.
>And the log file is not even created. Is there any problem in my log4j.xml?
>
>Thanks a lot
>David
>

--
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
IBM. Find simple to follow Roadmaps, straightforward articles, informative
Webcasts and more! Get everything you need to get up to speed, fast.
<a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

Re: How to get log4j work in Jetty4.2.24

Greg Wilkins-5
David Chen wrote:
> Thank you very much Ceki. It's my mistake, Jetty seems can not find
> ext/log4j.xml, so, either move log4j.xml to root directory, or using
> -Dlog4j.configuration=ext\log4j.xml will work.

the ext directory is a lib directory and not a classes directory.
You should be able to use the resources directory (which is really a classes directory)
in Jetty 5.  Jetty 4 has the etc directory on the resources path as well.

cheers


> Thanks a lot
>
> David
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: Tuesday, July 19, 2005 9:53 AM
> To: [hidden email]
> Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24
>
> Hello,
>
> The -Dlog4j.configuration=log4j.xml directive is redundant because log4j
> will default to searching for log4j.xml file before log4j.properties.
>
> For mire information about what log4j is doing, I'd highly recommend that
> you try the log4j.debug directive as in
>
> java -Dlog4j.debug ... etc.
>
> I hope this helps,
>
> At 06:19 PM 7/19/2005, David Chen wrote:
>
>>Hi, Jan:
>>
>>Thank you very much for the reply. I followed what you said: a. moved
>>log4j.xml to ext directory; b. run jetty as:
>>java
>>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JL
>>ogger -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
>>
>>However, I still got that problem:
>>
>>>log4j:WARN No appenders could be found for logger
>>>(com.xyz.myproject.web.Main).
>>>log4j:WARN Please initialize the log4j system properly.
>>
>>And the log file is not even created. Is there any problem in my log4j.xml?
>>
>>Thanks a lot
>>David
>>
>
>
> --
> Ceki Gülcü
>
>    The complete log4j manual: http://www.qos.ch/log4j/
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
> IBM. Find simple to follow Roadmaps, straightforward articles, informative
> Webcasts and more! Get everything you need to get up to speed, fast.
> <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> jetty-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-discuss
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

David Chen-6
In reply to this post by David Chen-6
Thank you Greg, it makes scense.

David

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]
Sent: Tuesday, July 26, 2005 8:42 AM
To: [hidden email]
Subject: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24

David Chen wrote:
> Thank you very much Ceki. It's my mistake, Jetty seems can not find
> ext/log4j.xml, so, either move log4j.xml to root directory, or using
> -Dlog4j.configuration=ext\log4j.xml will work.

the ext directory is a lib directory and not a classes directory.
You should be able to use the resources directory (which is really a classes
directory) in Jetty 5.  Jetty 4 has the etc directory on the resources path
as well.

cheers


> Thanks a lot
>
> David
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: Tuesday, July 19, 2005 9:53 AM
> To: [hidden email]
> Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24
>
> Hello,
>
> The -Dlog4j.configuration=log4j.xml directive is redundant because
> log4j will default to searching for log4j.xml file before
log4j.properties.

>
> For mire information about what log4j is doing, I'd highly recommend
> that you try the log4j.debug directive as in
>
> java -Dlog4j.debug ... etc.
>
> I hope this helps,
>
> At 06:19 PM 7/19/2005, David Chen wrote:
>
>>Hi, Jan:
>>
>>Thank you very much for the reply. I followed what you said: a. moved
>>log4j.xml to ext directory; b. run jetty as:
>>java
>>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J
>>L ogger -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
>>
>>However, I still got that problem:
>>
>>>log4j:WARN No appenders could be found for logger
>>>(com.xyz.myproject.web.Main).
>>>log4j:WARN Please initialize the log4j system properly.
>>
>>And the log file is not even created. Is there any problem in my
log4j.xml?

>>
>>Thanks a lot
>>David
>>
>
>
> --
> Ceki Gülcü
>
>    The complete log4j manual: http://www.qos.ch/log4j/
>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to speed,
fast.

> <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick">http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> _______________________________________________
> jetty-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-discuss
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
IBM. Find simple to follow Roadmaps, straightforward articles, informative
Webcasts and more! Get everything you need to get up to speed, fast.
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Re: How to get log4j work in Jetty4.2.24

Lebing Xie
In reply to this post by David Chen-6
You need a log4j.properties on your classpath.



such as
# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=DEBUG, MYCONSOLE
#log4j.rootCategory=WARN, MYCONSOLE
log4j.rootCategory=INFO, MYCONSOLE
#log4j.rootCategory=INFO, LOGFILE

# Set the enterprise logger category to FATAL and its only appender to
CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE

# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n

# MYCONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.MYCONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.MYCONSOLE.Threshold=DEBUG
log4j.appender.MYCONSOLE.layout=org.apache.log4j.PatternLayout
#log4j.appender.MYCONSOLE.layout.ConversionPattern=%d [%20.20t] %-5p %
30.30c %x - %m%n
log4j.appender.MYCONSOLE.layout.ConversionPattern=%20.20t %-5p %30.30c %
x - %m%n

# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.Threshold=INFO
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%
n

# settings for test classes
log4j.logger.de.fhg.fokus.common=WARN
log4j.logger.de.fhg.fokus.click2dial=DEBUG, MYCONSOLE
log4j.additivity.de.fhg.fokus.click2dial=false

#log4j.logger.main.ControllerRouter=DEBUG, MYCONSOLE
#log4j.additivity.main.ControllerRouter=false

#log4j.logger.de.fhg.fokus.javax.servlet.sip.FokusSipApplicationSession=DEBUG, MYCONSOLE
#log4j.additivity.de.fhg.fokus.javax.servlet.sip.FokusSipApplicationSession=false

log4j.logger.de.fhg.fokus.sipservlets.SessionRepository=DEBUG,
MYCONSOLE
log4j.additivity.de.fhg.fokus.sipservlets.SessionRepository=false

#log4j.logger.de.fhg.fokus.csbna.sip.CallService=DEBUG, MYCONSOLE
#log4j.additivity.de.fhg.fokus.csbna.sip.CallService=false

log4j.logger.de.fhg.fokus.csbna=DEBUG, MYCONSOLE
log4j.additivity.de.fhg.fokus.csbna=false

log4j.logger.de.fhg.fokus.sipservlets.SessionRepository=INFO, MYCONSOLE
log4j.additivity.de.fhg.fokus.sipservlets.SessionRepository=false

On Tue, 2005-07-19 at 09:41 -0700, David Chen wrote:

> Hi, there:
>
> Just follow up my previous email. If I unzip Jetty4.2.24-all package, after
> deploying my webapplications on its webapps directory, I did see everything
> is logged in logs\log4jetty.log, which means it takes
> extra\plus\resources\log4j.xml as log4j.configuration. However, if I unzip
> Jetty4.2.24.tar, and just copied the same log4j.xml and log4j.jar to ext\
> directory, and run jetty as:
> Java
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
> Jetty gives me warning as:
> log4j:WARN No appenders could be found for logger
> (com.xyz.myproject.web.Main).
> log4j:WARN Please initialize the log4j system properly.
> And no log file is created, nothing is logged correctly.
>
> Highly appreciated if anyone can help me on that issue. Thanks a lot in
> advance.
>
> David
>
>  
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: Tuesday, July 19, 2005 9:20 AM
> To: [hidden email]
> Subject: RE: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24
>
> Hi, Jan:
>
> Thank you very much for the reply. I followed what you said: a. moved
> log4j.xml to ext directory; b. run jetty as:
> java
> -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
> -Dlog4j.configuration=log4j.xml -jar start.jar etc\jetty.xml
>
> However, I still got that problem:
> > log4j:WARN No appenders could be found for logger
> > (com.xyz.myproject.web.Main).
> > log4j:WARN Please initialize the log4j system properly.
> And the log file is not even created. Is there any problem in my log4j.xml?
>
> Thanks a lot
> David
>  
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]]
> Sent: Tuesday, July 19, 2005 4:23 AM
> To: [hidden email]
> Subject: [jetty-discuss] Re: How to get log4j work in Jetty4.2.24
>
> David,
>
> AFAIK, you have to tell log4j where to find it's configuration file.
> So you have to use something like:
>
> -Dlog4j.configuration=log4j.xml
>
> Where log4j.xml has to be on the classpath, by which I mean the same
> classpath as the log4j.jar. So try copying the log4j.xml file into the /ext
> directory.
>
> regards
> Jan
>
> David Chen wrote:
> > Hi, there:
> >  
> > After using Jetty4.2.24, we have some issues on log4j. Our web
> > applications are using log4j for logs. Read the tutorial, so, I did
> > following steps:
> >  
> > a. moved log4j.jar from webapplication WEB-INF\lib to ext directory;
> > b. run: java
> > -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4J
> > Logger
> > -jar start.jar etc\jetty.xml
> >  
> > It gives me the warning:
> > log4j:WARN No appenders could be found for logger
> > (com.xyz.myproject.web.Main).
> > log4j:WARN Please initialize the log4j system properly.
> >  
> >  
> > my questions:
> > a. should I use log4j.properties or log4j.xml or either one will work
> > in Jetty4.2.24?
> > b. currently I put log4j.xml in
> > C:\jetty-4.2.24\webapps\myapplication\WEB-INF\lib, is that correct?
> >  
> > Highly appreciated if any suggestions
> >  
> > Thanks a lot
> >  
> > David
> >  
> > Here are my log4j.xml for your reference:
> >  
> > <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration
> > SYSTEM "log4j.dtd">
> >
> > <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
> > debug="false">
> >  
> >  
> >   <!-- ============================== -->
> >   <!-- Append messages to the console -->
> >   <!-- ============================== -->
> >   <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
> >     <param name="Threshold" value="TRACE"/>
> >     <param name="Target" value="System.err"/>
> >  
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <!-- The default pattern: Date Priority [Category] Message\n -->
> >       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> > %m%n"/>
> >     </layout>
> >   </appender>
> >  
> >   <appender name="FILE" class="org.apache.log4j.FileAppender">
> >     <param name="Threshold" value="INFO"/>
> >     <param name="File" value="${jetty.home}/logs/WebBooker.log"/>
> >  
> >     <layout class="org.apache.log4j.PatternLayout">
> >       <!-- The default pattern: Date Priority [Category] Message\n -->
> >       <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
> > %m%n"/>
> >     </layout>
> >  </appender>
> >  
> >  
> >   <root>
> >     <appender-ref ref="CONSOLE"/>
> >     <appender-ref ref="FILE"/>
> >   </root>
> >  
> > </log4j:configuration>
>
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
> IBM. Find simple to follow Roadmaps, straightforward articles, informative
> Webcasts and more! Get everything you need to get up to speed, fast.
> http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> jetty-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-discuss
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from
> IBM. Find simple to follow Roadmaps, straightforward articles, informative
> Webcasts and more! Get everything you need to get up to speed, fast.
> http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> jetty-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-discuss
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> jetty-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-discuss



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss
Reply | Threaded
Open this post in threaded view
|

Odd Warning

Tony Seebregts
In reply to this post by Greg Wilkins-5
Hi Greg,

FYI, I'm getting an odd warning with redirects and authentication failures:

WARN  [SocketListener0-1] org.mortbay.http.HttpConnection - POST
/cibecs/test HTTP/1.1 HttpException(400,Bad Request,Missing Content).

Its generated at line 1029 in HttpConnection.

I've  had a brief look at the logic and it seems to have something to do
with the expect-continue handling though I can't quite figure out
exactly what so thought I would pass it on in case its significant. It
doesn't seem to affect anything much and HttpClient doesn't complain either.

regards

Tony Seebregts




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
jetty-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-discuss