0

I need to create application logs to capture users signing in/out and their requests, for that.

We're using Java EE, and thought that creating new log files (new txt file for each day) would be a good approach, but I see that people discourage doing that, the question is: why not do it that way, and what is the correct approach?

also - is there some way to get the application directory?

3 Answers 3

1

log4j is one of the popularly used logger for Java EE applications and the others are slf4j,logback

log4j has many features, one them being able to create daily log files.

and to answer your question,
creating daily log files does not cause any harm to your application.

Sign up to request clarification or add additional context in comments.

1 Comment

log4j has been superceded by slf4j and logback
0

Logging to text files and rolling them daily is quite a normal approach and discouraging it per se is not justified.

For some specific uses it may be improper, for example if you log sensitive data (passwords, card numbers, etc.). There may be also issues with some cluster configurations, but then you have to ask a more detailed question.

Comments

0

Log4J works fine, but once you have many different Applications logging to many different Log files in different locations, you encounter the problem of having to search many log files to find the trace of certain Transaction.

One colleague recommended GrayLog2 once, which makes the viewing of the Log Files a lot easier.

You might want to take a look at that as well, depending on how many Log files your planning to keep.

http://graylog2.org/about

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.