logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stauffer" <stauffer.ja...@gmail.com>
Subject Re: File and Console Appenders question
Date Mon, 04 Jun 2007 14:06:08 GMT
1. No.
2,3. http://logging.apache.org/log4j/docs/manual.html
4.  Attach two appenders to the one logger.
5. No.


On 6/1/07, untz <untz786@yahoo.com> wrote:
> Hello there,
>
> I am using an init servlet to load my log4j.properties file during app start up...
> public class Log4jInitServlet extends HttpServlet {
>      public void init() throws ServletException {
>                 Properties props = new Properties();
>                 try {
>             props.load(this.getClass().getClassLoader().getResourceAsStream(
>                                         "/log4j.properties"));
>                 } catch (IOException e) {
>                    e.printStackTrace();
>                 }
>         }
> }
>  The log4j.properties file:
> log4j.rootLogger=WARN, stdout
> log4j.logger.acme.myapp=DEBUG
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
>  Question(s):
>
> (1)
> Let's say I want to use a file appender for logging different parts of
> the app's behavior, do I need to create a different properties file?
>
> (2) If not, how would I integrate that with the properties file above?
>
> (3) Is there a way I set the DEBUG warning to just log to the Console and the LOG warning
to just log to specific files (which I specify)?
>
> (4) What if I wanted two separate log files generated for the file appender?
>
> (e.g. one being for cars.log and another one being planes.log)
>
> (5) Do I have to create a different init servlet and different properties file?
>
> Happy programming,
>


-- 
James Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

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


Mime
View raw message