Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log4j - Looking for a good 'Getting started' tutorial or blog [closed]

I downloaded Log4j version 1.2.16 today. I want to enable logging in a simple java console application. I'm looking for a 'quick start' tutorial or blog that allows me to perform file logging with some good code samples.

like image 441
Dean Avatar asked Dec 06 '10 19:12

Dean


2 Answers

The short introduction to log4j is a perfectly fine starting point for log4j.

If you're ready to spend some money, you can buy the log4j manual.

By the way, if you're new to logging in Java, I'd suggest the slf4j + logback combo. In my opinion, this is the best logging solution available. Slf4j is a logging "facade" and it needs an implementation underneath. Log4j and logback can be used as implementations.

Since logback is log4j's successor and made by the same author, I'd suggest using it instead. Not only that, logback's manual is available online and it's free.

Since log4j's development has more or less stalled, I'd suggest you upgrade to slf4j + logback.

like image 92
darioo Avatar answered Sep 28 '22 14:09

darioo


Please see whether this "How to integrate log4j with Java project" helps you. It takes you through 5 quick steps.

  • Set up the project with log4j
  • Create log4j.properties file
  • Write a class to record log messages
  • Compile and run program
  • Check the log messages

Even though the question is older, as you have asked for a tutorial or a blog post on how to get started quickly, I thought of sharing this.

like image 32
lkamal Avatar answered Sep 28 '22 15:09

lkamal