Nicko Cadell | 2 Apr 23:44 2006

RE: Log4Net suddenly stops logging

Sven,

As far as I know this isn't a known problem.
Can you reproduce this issue with log4net internal debugging enabled?
http://logging.apache.org/log4net/release/faq.html#internalDebug
Or do you have a simple test case that reproduces this issue?

Cheers,
Nicko 

> -----Original Message-----
> From: Lohberg, Sven [mailto:Sven.Lohberg <at> Aspect.com] 
> Sent: 30 March 2006 08:52
> To: log4net-user <at> logging.apache.org
> Subject: Log4Net suddenly stops logging
> 
> Hi,
> 
>  
> 
> I am using log4net 1.2.0-beta8 in a multithreaded 
> windows-service written in C#. The application is using the 
> RollingFileAppender. While performing some load tests, where 
> a large number of entries have been written, suddenly it can 
> happen that no more log lines are written while the 
> application itself still continues to work properly.
> 
>  
> 
> I could read from previous older support mails, that such an 
(Continue reading)

Nicko Cadell | 3 Apr 02:04 2006

RE: Logging of the errors in logging

Log4net is designed to be a best effort logging system, not a reliable
system. If there is a problem logging log4net will not propagate errors
into the calling application. 
While the current internal error handling is not flexible enough it is
unlikely that it will be changed to accommodate a completely reliable
logging scenario. 

Regards,
Nicko

> -----Original Message-----
> From: unegov [mailto:unegov <at> skbkontur.ru] 
> Sent: 30 March 2006 08:43
> To: log4net-user <at> logging.apache.org
> Subject: Logging of the errors in logging
> 
> Log4net is a great tool but I'm not fully satisfied how 
> log4net deals with errors in logging. In my project it is 
> necessary not to lose any logging messages if the logging is 
> on so I would prefer log4net threw exceptions rather than 
> wrote errors of logging into Console.Error and Trace as 
> information messages. I'm ready to catch such sort of 
> exceptions at the top level of my code. But I have no way to 
> override the behaviour of the LogLog class.
> 
> All I can do is to intercept Console.Error and rethrow 
> exceptions in the interception code but in this case I wont 
> always get complete exception messages and it doesnt look 
> beautiful at all.
> 
(Continue reading)

unegov | 3 Apr 05:44 2006
Picon

Re[2]: Logging of the errors in logging

Ok. But nevertheless log4net propagates logging problems into
Console.Error and into Trace. Can I expect that in the near or distant
future log4net will allow me to override this behaviour?
I think it would not contradict the ideology of log4net as a best
effort logging system. It would just give me chance to change the way
I monitor problems with logging.

Thanks.

Best regards,
Stepan Unegov.

NC> Log4net is designed to be a best effort logging system, not a reliable
NC> system. If there is a problem logging log4net will not propagate errors
NC> into the calling application. 
NC> While the current internal error handling is not flexible enough it is
NC> unlikely that it will be changed to accommodate a completely reliable
NC> logging scenario. 

NC> Regards,
NC> Nicko

>> -----Original Message-----
>> From: unegov [mailto:unegov <at> skbkontur.ru] 
>> Sent: 30 March 2006 08:43
>> To: log4net-user <at> logging.apache.org
>> Subject: Logging of the errors in logging
>> 
>> Log4net is a great tool but I'm not fully satisfied how 
>> log4net deals with errors in logging. In my project it is 
(Continue reading)

Ron Grabowski | 3 Apr 06:26 2006
Picon

Re: Re[2]: Logging of the errors in logging

Your application can process messages written to
System.Diagnostic.Trace by using code like this in your App.Config:

<system.diagnostics>
 <trace autoflush="true">
  <listeners>
   <add name="textWriterTraceListener" 
    type="System.Diagnostics.TextWriterTraceListener"
     initializeData="C:\\Company\\Application\\Logs\\log4net.txt" />
  </listeners>
 </trace>
</system.diagnostics>

You can also configure that in code.

--- unegov <unegov <at> skbkontur.ru> wrote:

> Ok. But nevertheless log4net propagates logging problems into
> Console.Error and into Trace. Can I expect that in the near or
> distant
> future log4net will allow me to override this behaviour?
> I think it would not contradict the ideology of log4net as a best
> effort logging system. It would just give me chance to change the way
> I monitor problems with logging.
> 
> Thanks.
> 
> Best regards,
> Stepan Unegov.
> 
(Continue reading)

unegov | 3 Apr 06:56 2006
Picon

Re[4]: Logging of the errors in logging

Yes, I could but error messages and debug messages are not separated
in the Trace: log4net uses Trace.WriteLine for both. In my case I
would prefer the executing code to be interrupted if the error
occured. And when I'm talking about it I don't mean that log4net has
to be a reliable logging system. I could also intercept Console.Error
but logging error messages are written to Console.Error in one or two
steps: extra error message and then exception description or error
message alone. It is not convenient to see only extra message after
code execution was interrupted. By the way it would be a pure
workaround, not the regular usage of the log4net.

RG> Your application can process messages written to
RG> System.Diagnostic.Trace by using code like this in your App.Config:

RG> <system.diagnostics>
RG>  <trace autoflush="true">
RG>   <listeners>
RG>    <add name="textWriterTraceListener" 
RG>     type="System.Diagnostics.TextWriterTraceListener"
RG>      initializeData="C:\\Company\\Application\\Logs\\log4net.txt" />
RG>   </listeners>
RG>  </trace>
RG> </system.diagnostics>

RG> You can also configure that in code.

RG> --- unegov <unegov <at> skbkontur.ru> wrote:

>> Ok. But nevertheless log4net propagates logging problems into
>> Console.Error and into Trace. Can I expect that in the near or
(Continue reading)

Christopher Quest | 3 Apr 17:43 2006

Class Library Logging

Hi,
 
I am using V1.2.0-beta8, on a test .DLL written in C# against .NET1.1 with the DLL being called from a C# windows application.
 
I have this attribute in the the Assemblyinfo.cs file:
 
[assembly: DOMConfiguratorAttribute(ConfigFile="UIFeasibility.log.config",Watch=true)]

I am setting up the logger as follows:

private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Then using the logger as normal:

if (log.IsDebugEnabled) log.Debug("Constructor called");

This is my configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
        <logger name="UIFeasibility" additivity="false">
                <level value="DEBUG"/>
                <appender-ref ref="FileAppender" />
        </logger>

        <root>
                <level value="DEBUG" />
        </root>

        <appender name="FileAppender" type="log4net.Appender.FileAppender">
                <file value="Log-file.txt"/>
                <appendToFile value="true"/>
                <filter type="log4net.Filter.LevelRangeFilter">
                        <levelMin value="INFO"/>
                        <levelMax value="FATAL"/>
                </filter>
                <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%date  %-5level %logger - %message%newline" />
                </layout>
        </appender>

</log4net>

When the class library is accessed all of the log statments are executed but after the windows application is closed down there is not text in the log file even though it is created if it doesn't exists. This mechanism has perviously worked on a windows service.

Matthew Brown | 3 Apr 22:31 2006
Picon

Re: Class Library Logging

Is there a reason why there are no appender-ref's in the root element? I would start there...

I think the next step someone would ask is if you see anything using the internal log4net logging.

On 4/3/06, Christopher Quest <christopher.quest <at> herbertgroup.com> wrote:
Hi,
 
I am using V1.2.0-beta8, on a test .DLL written in C# against .NET1.1 with the DLL being called from a C# windows application.
 
I have this attribute in the the Assemblyinfo.cs file:
 
[assembly: DOMConfiguratorAttribute(ConfigFile="UIFeasibility.log.config",Watch=true)]

I am setting up the logger as follows:

private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

Then using the logger as normal:

if (log.IsDebugEnabled) log.Debug("Constructor called");

This is my configuration file:

<?xml version="1.0" encoding="utf-8" ?>
<log4net>
        <logger name="UIFeasibility" additivity="false">
                <level value="DEBUG"/>
                <appender-ref ref="FileAppender" />
        </logger>

        <root>
                <level value="DEBUG" />
        </root>

        <appender name="FileAppender" type="log4net.Appender.FileAppender">
                <file value="Log-file.txt"/>
                <appendToFile value="true"/>
                <filter type="log4net.Filter.LevelRangeFilter">
                        <levelMin value="INFO"/>
                        <levelMax value="FATAL"/>
                </filter>
                <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%date  %-5level %logger - %message%newline" />
                </layout>
        </appender>

</log4net>

When the class library is accessed all of the log statments are executed but after the windows application is closed down there is not text in the log file even though it is created if it doesn't exists. This mechanism has perviously worked on a windows service.


Ernst Kuschke | 4 Apr 11:37 2006
Picon

Dynamic Appenders

Hi,

I am really a newbie at log4net. I want to dynamically configure loggers, and I do this as follows:

private static ILog ConfigureLogger(AuditType logType, string destination)
        {
                switch (logType)
                {
                    case(AuditType.Database):
                        appender = (AdoNetAppender)hierarchy

.GetLogger(Enum.GetName(typeof(AuditType), logType), hierarchy.LoggerFactory ).GetAppender(LOG_NAME);
                        if (appender == null)
                        {
                            appender = new AdoNetAppender();
                            //here I set some properties for the appender...
                    case(AuditType.TextFile):
                        {
                            //blah... you get the idea...
                        }
                }
                appender.Name = Enum.GetName(typeof(AuditType), logType);
                log4net.Config.BasicConfigurator.Configure(appender);
                ..........

Now how do I get the logger that uses the configured IAppender?!
Thanks in advance!!!


--
Ernst Kuschke
MVP - C#
http://dotnet.org.za/ernst
Ganapatiraju, Shiva (OCFS | 5 Apr 16:23 2006
Picon

Logging of the errors

Hi Ron, 
I want to log into my LocalHost  for errors. But does not seem to do
that. 

 <appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender,log4net">
      <param name="File" value="http://Localhost/SSOPAppLog.txt" />
      <param name="AppendToFile" value="true" />
      <param name="MaxSizeRollBackups" value="10" />
      <param name="MaximumFileSize" value="5MB" />
      <param name="RollingStyle" value="Size" />
      <param name="StaticLogFileName" value="true" />
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] -
%m%n" />
      </layout>
    </appender>

Any help is appreciated.

With warm regards,
Shiva 

Shiva Ganapatiraju
Developer - SSOP , NYS - OCFS 
518-473-7785  (Albany) : 
AD0149 <at> dfa.state.ny.us
Check out our Engagement Dashboard 
http://sdssnet5/ocfs/admin/ofm/rsu 
--------------------------------------------------------
This communication, together with any attachments hereto or links contained herein, is for the sole use of
the intended recipient(s) and may contain information that is confidential, privileged, or legally
protected, and as such is not a public document.  If you are not the intended recipient, you are hereby
notified that any review, disclosure, copying, dissemination, distribution or use of this
communication is STRICTLY PROHIBITED. If you have received this communication in error, please notify
the sender immediately by return e-mail message and delete the original and all copies of the
communication, along with any attachments hereto or links herein, from your system.

Saurabh Dani | 6 Apr 12:24 2006

Loggin to multiple appenders

Greetings All,

Is it possible to write to more than one appenders? In the FAQs I read that it is possible to do so, but could not find an example.

I would like to write the debug logs to a fileappender (if debug logging is turned on), and info logs to a database. Is this possible with log4net?

Thanks
Saurabh


Gmane