1

I am new to logging,
In my project we are starting to log the flow of project. from starting to end of the execution. we used simple write operations to log.

File,FileOutputStream  

But i have seen tools like log4j,slf4j...etc im in a confusion what to use and how to use. I have seen many examples , but notthing matched my requirement . which led to post a question here.

Q1) Which is the best log tool ? (we need to log nearly 1000 lines per day)
Q2) In the present project we are creating(with code) a new folder every day , and logging in that by using File,FileOutputStream,SimpleDateFormat...etc

Q3)Many configuration files give log file path hard coded.
example : org.slf4j.simpleLogger.logFile= /tmp/myapp.log
But in my project we need to create new folder every day.
like, path should be /tmp/20150419/myapp.log
20150419 is today's date. and tomorrow log should be in 20150420 Is this possible ?

Please clarify , i will be thankful to you .

LMK
  • 2,882
  • 5
  • 28
  • 52

1 Answers1

0

Q1 is opinion based, SO is not the place for such questions.

Q2 is not a question.

Q3 is not a question and not true. Every modern log framework provides means to define where you want to log, what to log and how to log it. They may have hard coded defaults, so you do not have to configure everything, but the ability is there. Case in point: logback create log files inside folder having name as current date

None of the requirements you mention are a challenge for today's logging frameworks, in fact they read very basic and simple.

As already mentioned by Thorbjørn, a good choice would be logback, coupled with its interface SLF4J. The latter also provides means to switch to other logging implementations if you ever find logback to not be what you need. I suggest you familiarize yourself with logback and its capabilities via its documentation and then decide whether it fits your requirements.

Community
  • 1
  • 1
sheltem
  • 3,754
  • 1
  • 34
  • 39