RE: ConsoleAppender and want to write some specific logs in my log file


Two questions from log4j:-

1. Like what is the use of ConsoleAppender whether I have already able to see the output on console.
2. By using FileAppender in my log4j.xml, I am able to write all logs in logfile.log . But what if I am only want to write some specific logs in my log file..

shubham Train Asked on September 16, 2014 in Selenium WebDriver.

Please mark your questions as ANSWERED, if your query is resolved.

Lakshay Sharma

on September 18, 2014.
Add Comment
3 Answers
Best answer

Console is a feature of your Eclipse IDE. Its a centralized place to intercept System.out and System.err streams. In a non Eclipse way of running your code you will always need to pass your logs to Any of the two streams based on the types of log. Errors go to System.err and regular logs go to System.Out.

This is exactly what ConsoleAppender does. It passes the logs to any of the two streams.


Professor Answered on September 18, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.