Byron Neudesic | 8 Feb 18:42
Gravatar

UpdAdapter does not seem to be working


Hi All,
I have been attempting to use the UdpAdapter and Chainsaw to demonstrate
alternative logging methods. It does not seem that when I try to send a log
message that the UdpAdapter is actually sending messages.

 I am sending messages to the event logger, and that is just fine. I am
wondering if there are some advice I can be given to determine the possible
cause of my issues.

I am running Windows 7 Enterprise 64 bit, VS 2010 Ultimate using the NET 4.0
framework.

To troubleshoot, I also installed Wireshark to have an independent tool to
determine if messages are getting sent. It registers no messages on the port
that I have selected to send the logging. I have disabled my firewall to see
if that would resolve the problem.

I am not getting any errors from the logger to indicate that I am not able
to initalize the appender. However, when I look at the appender collection
on the log instance, it shows a count of zero. This is the case even when I
successfully log to the the event log, so I am not sure if that is a
concern.

I know that UDP is not guaranteed delivery; I am OK with that. I just want
to know that I am actually sending the messages.

Here is my config for my app:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
(Continue reading)

mmingfeilam | 1 Feb 20:12
Picon
Gravatar

log4net AdoNetAppender common connectionstring value


i have two exes in my solution that are run simultaeneously.  each exe has a
log4net.xml file with a AdoNetAppender in it:
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <bufferSize value="100" />
    <connectionType value="System.Data.SqlClient.SqlConnection, System.Data,
Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <connectionString value="data source=[database server];initial
catalog=[database name];integrated security=false;persist security
info=True;User ID=[user];Password=[password]" />
    <commandText value="INSERT INTO Log
([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date,
@thread, @log_level, @logger, @message, @exception)" />
    <parameter>

is there any way to move the value of the connectionstring to a common file
and just reference it by name?  would it be possible to move the appenders
to one common location as well?  i want to do it using a config file and not
programmatically.  thanks.

--

-- 
View this message in context: http://old.nabble.com/log4net-AdoNetAppender-common-connectionstring-value-tp33244792p33244792.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Roman Konovalov | 29 Jan 12:25
Gravatar

Performance saving logs to the database

Hi,

 

We have web server with about 60,000 page visits a day. Within the next 6 months the load is expected to reach 1,000,000 page visits a day. We use log4net to store logs into the log database.

What is now unclear to me is if log4net is able to manage such a big load from performance point of view. Log4net is synchronous and if log database is down, then the entire process is waiting for log4net return call back (I assume it returns call back when database connection timeout occurs).

 

Should we write our own appender to save logs into the database asynchronously?

Or we would revisit our logging strategy and log only exceptions and errors in production environment, turning on other levels of logging during troubleshooting time?

 

Many thanks for replies.

 

Best regards,

Roman

 

Roman Konovalov | 29 Jan 12:24
Gravatar

Can log4net return exceptions back

Hi,

 

Is it possible to setup log4net to re-throw exceptions back to caller? For example, if logging to database is timed out, we might want to save such exception to a file or to send e-mail to the support team. Thank you.

 

Best regards,

Roman

 

Jayashree Kumar | 16 Jan 06:35
Favicon

RemotingAppender and

Hi,

 

I have an application in which I have tried to use both a FileAppender and a RemotingAppender.

 

I notice that when I have the following line in my config file, both appenders work fine:

 

<onlyFixPartialEventData value="true" />

 

When I do not have this line or set the value to “false”, then the FileAppender continues to work, but my RemotingAppender stops working.

 

You may wonder why I wish to set onlyFixPartialEventData to “false”. The reason:

 

My application is multi-threaded and creates a fixed number of threads. My loggers are static loggers (not instance loggers), and I have 2 of them. When I set onlyFixPartialEventData to “true”, I see that the number of threads in my application increases with time. These threads never seem to terminate.

 

How do I avoid this multiplication of threads?

 

Thanks in advance for any help.

 

Regards,

Jaya.

 

stephanie.giovannini | 11 Jan 17:38

Logger in ASP.NET stops after a few hours, won't restart until app is cycled

I have a logger attached to an ASP.NET project. In test environments, the logger always works. In production (much higher user load), the logger stops after a few hours and won’t restart until the app is cycled. I made modifications to make the logger thread-safe, but that didn’t fix the problem. I’m at a loss for how to troubleshoot since it only stops under high user load.
 
In production, there are around 30 web servers and one database. I don’t know if that makes a difference. It’s not a problem when I run other stored procedures.
 
I have years of experience with log4net, but before I’ve always used it in a server application, not on a web server.
 
I don’t have any idea of where to start debugging this, so I’m attaching most of the relevant code, with some names changed:
 
Web.config:
 
<log4net>
    <appender name="XDbAppender" type="X.CustomAdoNetAppender">
      <bufferSize value="1"/>
      <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <connectionString value="data source=[server]; initial catalog=[dbname]"/>
      <commandText value="exec dbo.spSetLogMessage <at> date, <at> level, <at> msg, <at> exc"/>
      <parameter>
        <parameterName value=" <at> date" />
        <dbType value="DateTime" />
        <layout type="log4net.Layout.RawTimeStampLayout" />
      </parameter>
      <parameter>
        <parameterName value=" <at> level" />
        <dbType value="String" />
        <size value="10" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value=" <at> msg" />
        <dbType value="String" />
        <size value="2000" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value=" <at> exc" />
        <dbType value="String" />
        <size value="4000" />
        <layout type="log4net.Layout.ExceptionLayout" />
      </parameter>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="XDbAppender"/>
    </root>
  </log4net>
 
Global.asax:
 
<% <at> Application Language="C#" Inherits="Microsoft.Practices.CompositeWeb.WebClientApplication" %>
<% <at> Import Namespace="Y" %>
<script Language="C#" RunAt="server">
 
    private static readonly log4net.ILog Logger = log4net.LogManager.GetLogger("AppName");
    private static readonly object Locker = new object();
 
    protected override void Application_Start(object sender, EventArgs e)
    {
        lock (Locker)
        {
            log4net.Config.XmlConfigurator.Configure();
            Logger.Info("Started");
        }
        base.Application_Start(sender, e);
    }
 
    protected void Application_Error(object sender, EventArgs e)
    {
        lock (Locker)
        {
            var ex = Server.GetLastError();
 
            // exception has already been handled
            if (ex == null) return;
 
            string pageName = string.Empty;
 
            try
            {
                pageName = Request.CurrentExecutionFilePath;
            }
            catch (HttpException exc)
            {
                Logger.Warn(exc.Message);
            }
 
            var innermostEx = ex;
            while (innermostEx.InnerException != null) innermostEx = innermostEx.InnerException;
 
            string exceptionMessage = innermostEx.GetType().Name + ": " + innermostEx.Message;
 
            UserLogin ul = null;
            try
            {
                ul = (UserLogin) Session["LoggedInUser"];
            }
            catch (HttpException exc)
            {
                if (exc.Message != "Session state is not available in this context.")
                {
                    Logger.Warn(exc.Message);
                }
            }
 
            string message = string.Empty;
            if (ul != null)
            {
                message += "User:" + ul.Anumber;
            }
            if (pageName != string.Empty)
            {
                message += " Page:" + pageName;
            }
            if (exceptionMessage != string.Empty)
            {
                message += " Msg:" + exceptionMessage;
            }
 
            Logger.Error(message, ex);
        }
    }
 
    </script>
 
Custom DB appender (gets the correct connection string for the environment):
 
using Commons;
using log4net.Appender;
 
namespace X
{
    public class CustomAdoNetAppender : AdoNetAppender
    {
        public new string ConnectionString
        {
            get
            {
                return base.ConnectionString;
            }
            set
            {
                base.ConnectionString = (Common.GetConnectionString());
            }
        }
    }
}
 
Can anyone suggest where log4net is failing under high load, and why it stops entirely?
 
 
Stephanie Giovannini
 
 
 
Venkatasamy, Vanitha | 29 Dec 17:51
Favicon

File Name issue with RollingFileAppender in Log4net RSS

Hi All,

I have implemented RollingFileAppender to log my ASP errors and it works fine.
Now i need to change the file names based on the date value. Currently my log file  name is MyLog.log ,its max size is 1 MB and maxBackup is 10. Now i want my log files with date like MyLog_2011-12-29 for each day. I tried the below settings, but its not appending the date value to the file name and it just creates the file as MyLog. Any suggestions ?

     <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="C:\\TestProj\\MyLog"/> 
      <staticLogFileName value="false"/>
      <appendToFile value="true"/>
      <rollingStyle value="Composite"/>
      <eventId value="5" />
      <eventCategory value="ErrorLogging" />
      <datePattern value="yyyy-MM-dd'.log'" />
      <maxSizeRollBackups value="10"/>
      <maximumFileSize value="1MB"/>
      <staticLogFileName value="true"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n"/>
      </layout>
    </appender>

 

 

 

Thanks,



This message contains Devin Group confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this e-mail in error and delete this e-mail from your system. E-mail transmissions cannot be guaranteed secure, error-free and information could be intercepted, corrupted, lost, destroyed, arrive late, incomplete, or contain viruses. The sender therefore does not accept liability for errors or omissions in the contents of this message which may arise as result of transmission. If verification is required please request hard-copy version.
Michele Lepri | 22 Dec 11:23
Picon

Tcp Appender

Hello all,
this is my first time here ^^

I can't find any Tcp Appender on the net, and so I'm going to write one
because I want to use it for monitoring purpose in development environment.
If the work will be fine I will publish it.

I would like to ask to you: any advice about it?
I know it will be very slow, and maybe this is the reason because none
wrote one before..

Thanks
have a nice day
michele

--

-- 
http://michelelepri.blogspot.com/

Venkatasamy, Vanitha | 20 Dec 20:32
Favicon

log4Net -EventLogAppender

Hi All,

 

I am  using log4net – EventLogAppender to log the application errors. But the errors are also logged in Event viewer –Application log. Since I have my own log4net event viewer ,is it possibe to stop the errors being logged into Application  event viewer.

 

Thanks,

Vanitha



This message contains Devin Group confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this e-mail in error and delete this e-mail from your system. E-mail transmissions cannot be guaranteed secure, error-free and information could be intercepted, corrupted, lost, destroyed, arrive late, incomplete, or contain viruses. The sender therefore does not accept liability for errors or omissions in the contents of this message which may arise as result of transmission. If verification is required please request hard-copy version.
Peter Bickford | 11 Dec 20:16
Gravatar

Upgrading from beta to current version--assembly binder tries to use old version

I'm attempting to upgrade (at last!) the log4net install on my ASP.NET (II7, 64 bit, Windows 2008) web site to log4net v1.2.11.0. The web app was originally built with v1.2.0.30714. Unfortunately, simply replacing the reference  in my ASP.NET Bin directory results in the error:

Could not load file or assembly 'log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Ironically, Log4Net dutifully records the attempt to bind to the obsolete version fo log4Net:

=== Pre-bind state information ===
LOG: User = XXX (obscured)
LOG: DisplayName = log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=b32731d11ce58905
 (Fully-specified)
LOG: Appbase = file:///E:/Websites/MySite/www/dev/
LOG: Initial PrivatePath = E:\Websites\MySite\www\dev\bin
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: E:\Websites\MySite\www\dev\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=b32731d11ce58905
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/dev/bbf437a3/411124d9/log4net.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/dev/bbf437a3/411124d9/log4net/log4net.DLL.
LOG: Attempting download of new URL file:///E:/Websites/MySite/www/dev/bin/log4net.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

The relevant section of web.config is:

    <section name="log4net"  type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />

I've also attempted to strongly type the new log4Net, e.g.:

    <section name="log4net"  type="log4net.Config.Log4NetConfigurationSectionHandler, log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" />

...as well as doing the above and installing the new assembly into the GAC. Same error occurs.

Where the heck is IIS/ASP.Net storing the old version info so I can replace it for this assembly?

Thanks!

-Pete

 

Favicon

Log4Net for asp errors

Hi All,

  

 I have implemented Log4Net in my application which logs errors for  both ASPX and ASP .

 

I am using EventLogAppender and AppenderSkeleton[extended for sending alert emails when threshold ia reached ] for aspx as below.its working fine

 

<log4net debug="true">

            <appender name="sendAlertAppender" type="sendAlertAppender.MultiThresholdNotifyingAppender,sendAlertAppender">

           

            <LevelThreshold value="ERROR" />

             <appender-ref ref="EventLogAppender" />

            </appender>

            <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">

                  <param name="LogName" value="PortalWebLogs" />

                  <param name="ApplicationName" value="Portals" />

                  <filter type="log4net.Filter.LevelRangeFilter">

                        <acceptOnMatch value="true" />

                        <levelMin value="INFO" />

                        <levelMax value="FATAL" />

                  </filter>

                  <layout type="log4net.Layout.PatternLayout">

                        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />

                  </layout>

            </appender>

            <root>

                  <level value="ALL" />

                  <priority value="ERROR" />

                  <appender-ref ref="sendAlertAppender" />

                  <appender-ref ref="EventLogAppender" />

            </root>

      </log4net>

 

For ASP also , I am using the same method with RollingLogFileAppender ,but maintaing the separate config file in bin folder as below

 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

  <configSections>

    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>

  </configSections>

  <log4net debug="true">

    <appender name="sendAlertAppender" type="sendAlertAppender.MultiThresholdNotifyingAppender,sendAlertAppender">   

      <LevelThreshold  value="ERROR"/>     

      <appender-ref ref="RollingLogFileAppender"/>

    </appender>

    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">

      <file value="C:\\TestProj\\TestLog.txt"/>

      <appendToFile value="true"/>

      <rollingStyle value="Size"/>

      <eventId value="5" />

      <eventCategory value="ErrorLogging" />

      <maxSizeRollBackups value="10"/>

      <maximumFileSize value="10MB"/>

      <staticLogFileName value="true"/>

      <layout type="log4net.Layout.PatternLayout">

        <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n"/>

      </layout>

    </appender>

    <root>

      <level value="ALL"/>

      <priority value="ERROR"/>

      <!--<level value="DEBUG"/>-->

      <appender-ref ref="sendAlertAppender"/>

      <appender-ref ref="RollingLogFileAppender"/>

    </root>

  </log4net>

  <appSettings>

    <add key="log4net.Internal.Debug" value="true"/>

  </appSettings>

</configuration>

</configuration>

 

 

The issue is the above is working fine for RollingLogFileAppender ,but sendAlertAppender is not working. If I add the below configuration in my web.config file the sendAlertAppender is working but not the RollingLogFileAppender .

 

<compilation> 

    <buildProviders>

           <add extension=".asp" type="System.Web.Compilation.PageBuildProvider"/>       

     </buildProviders>        

</compilation>       

 <httpHandlers>    

            <add path="*.asp" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true"/>

 </httpHandlers>

 

Any advice on this…

 

Thanks,

Vanitha

 



This message contains Devin Group confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately by e-mail if you have received this e-mail in error and delete this e-mail from your system. E-mail transmissions cannot be guaranteed secure, error-free and information could be intercepted, corrupted, lost, destroyed, arrive late, incomplete, or contain viruses. The sender therefore does not accept liability for errors or omissions in the contents of this message which may arise as result of transmission. If verification is required please request hard-copy version.

Gmane