This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I have a custom logger and a log4j.xml combination that, I hoped would send output to a specified persistent file. However, the content is being created and logged to the console instead. I'm not sure why (considering log4j is creating the intended log file). Clearly I'm missing a step. Can someone take a peak and clue me in? The code snippets are below:
private static final Logger logger = LoggerFactory.getLogger("DailyRoll");
logger.info(“text to add... report some stuff”);
How did you call your log4j property file, and where did you put it ?
Joined: Feb 28, 2011
Christophe Verré wrote:How did you call your log4j property file, and where did you put it ?
I am using a log4j.xml file placed within reach of my package. So, in eclipse it would be located at: /src/log4j.xml. Log4j is creating all the log files specified by the appenders I have defined. And, data is being written to those log files with the exception of my custom logger/appender definition (despite the file having been created by log4j).
It is curious. I thought I was having a conflict between jars somewhere but I ran through my environment to root-out potential conflicts. I think I have cleared them but still I'm stubbing my toes and smiling about it.
Log4j is raising the below warnig for your configuration
As mentioned by Christophe Verré, that space in the logger name is the problem. log4j does not ingore it. I have removed the space and tried ..its logging correctly to the log file.
Do you have a console appender configured in your xml? That may be the reason why log statements are going to the console.
Joined: Feb 28, 2011
I thought those who replied might like an update (so often missing from discussions). I located the source of my problem. It is a package conflict, after all. It would appear a vendor decided it would be a great idea to repackage all sorts of common/utility libraries with new names. They added a few folders to the base structure and TA-DAH... no-one's the wiser that name conflicts and package hell is afoot.... NOT!
Now... to figure a way isolate those monsters. Anyone have experience with this sort of suffering?