3

In debug mode Log4net is logging properly. In Release mode also it Logs properly. But the problem is that, in release mode if I log from one of specific class(only one), it doesn't log(that class logs in debug mode). Other classes are logging properly even in release mode using the same logger.

Here is the Config

        <root>
            <level value="INFO" />
        </root>
        <logger name="Japt">
            <level value="DEBUG" />
            <appender-ref ref="JaptAuditLogDbAppender" />
        </logger>

I am using the same config file for both debug and release mode.

Any help will be appreciated.

Bipul
  • 1,327
  • 4
  • 16
  • 33
  • log4net does not know the execution mode/how the exe is actually invoked. My guess is that you are accidently editing the wrong file. (e.g. release mode is set to debug as output directory). – weismat Jun 24 '10 at 08:37
  • I am not logging in file. I am logging in Database – Bipul Jun 24 '10 at 08:50
  • In the class that you are having problems with, how are you naming the logger? (Are you hardcoding a name, or are you dynamically determining the name?) Or maybe a good test would be to temporarily put something in the code to show a messagebox or whatnot that displays the logger's name at runtime (to verify it is what you expect), and show the result of calling the IsErrorEnabled function (or whatevet it is named) to see if it thinks it is enabled. – Mafu Josh Aug 14 '10 at 02:02
  • Possible duplicate - please review http://stackoverflow.com/questions/4045203/log4net-doesnt-log-when-running-a-net-4-0-windows-application-built-in-release and see if it's the same issue. – TrueWill Dec 27 '10 at 21:11

1 Answers1

0

If the class in question is small and simple, it could be converted into inline code by the optimizer.

If this is the case, then I think you can add an attribute to display the inlining, eg

[MethodImpl(MethodImplOptions.NoInlining)]
void Japt()
sgmoore
  • 15,694
  • 5
  • 43
  • 67