views:

26

answers:

2

I want to log my exceptions in a file. What will be the name of the file?

  1. Error-ddmmyyyy.log
  2. Log-ddmmyyyy.err
  3. Log-ddmmyyyy.txt

or anything else?

A: 

If date is important, I would use yyyymmdd format: this is easier to get a sorted list. I would add hhmmss if relevant.

.log suffix is nice for me.

I would add the name of the command issuing exceptions as a prefix of the logfile.

Something like: myCommand-20100315-114235.log

mouviciel
A: 

There are many ways you can name your log files, you have to consider several factors:

Is your file generated by a special server or application in a group? Then you should add the name of the server to know where it does come from. Example:

Server1.log

In the log file there could be many levels of logging, if you want you can configure different files for different levels. Example

Server1.info.log
Server1.err.log

You should add a date if your application runs for many days or if you want to keep track of errors for future reference, add it at the start of the name in yyyyMMdd format on windows or linux so they will be sorted by date automatically in command line commands or add it at the end if you want them more organized:

Server1.info.log.20100315 (Linux)
Server1.info.20100315.log (Win)

You can try with different combinations, it all depends on what sorting style and archiving style you want to achieve.

Lex
Is it required to maintain 3 different log files for DBPeople, for Business developer and for user.
Arpita
But they should see the same data or different kind of logs?
Lex