1

Where is the default location of the log file if the log4net framework is not able to write the logs in the location that is configured in the web.config?

Fildor
  • 14,510
  • 4
  • 35
  • 67
Sudhi
  • 27
  • 1
  • 1
    Welcome to stackoverflow. Please take a minute to take the [tour], especially [ask], and [edit] your question accordingly. – jazb May 20 '19 at 05:36
  • I'd suspect in that case no logs are written at all. But you could investigate by turning on internal logging: See https://stackoverflow.com/a/756241/982149 – Fildor May 20 '19 at 06:09
  • @JohnB The question is short but clear and specific. How would you improve on it? I don't see why it would need editing. – Fildor May 20 '19 at 06:25
  • 1
    There is no default location if for exemple the logger don't have the right to write in the directory or the path do not exist. – xdtTransform May 20 '19 at 06:32

1 Answers1

3

[...] If the file cannot be opened for writing the appender will attempt to open the file again each time a message is logged to the appender. If the file cannot be opened for writing when a message is logged then the message will be discarded by this appender.

Source: Log4Net - FileAppender

Emphasis by me.

So, there is no "default location". The messages will not be written and the file will not be created if the user does not have the appropriate rights on the specified path.

I haven't checked, but I suspect this also applies to RollingFileAppender.

Fildor
  • 14,510
  • 4
  • 35
  • 67
  • Thanks for your comments.The log folder having all the permission including the app pool user. And logs were writing also, but suddently its stopped without making any change in the application level. Normally in such scenarios application will write in event viewer, but there is no specific error we could see in the server event viewer. – Sudhi May 24 '19 at 04:32