You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "stalinsubash (Created) (JIRA)" <ji...@apache.org> on 2012/04/10 11:10:13 UTC

[jira] [Created] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
--------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: LOG4NET-332
                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
             Project: Log4net
          Issue Type: New Feature
          Components: Appenders
    Affects Versions: 1.2.9
         Environment: windows 7 , VS2010
            Reporter: stalinsubash
            Priority: Blocker


Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Re: [jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by Ron Grabowski <ro...@yahoo.com>.
Maybe OpenFile isn't the best place to look for error. If you want access to a logging event so you can send it somewhere else if writing to the appender fails you'll probably need to check that the previous write was successful higher up in the chain in one of the DoAppend methods. I'll keep thinking about this and try to write some code.



________________________________
 From: stalinsubash (Commented) (JIRA) <ji...@apache.org>
To: log4net-dev@logging.apache.org 
Sent: Wednesday, April 18, 2012 6:59 AM
Subject: [jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
 

    [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256436#comment-13256436 ] 

stalinsubash commented on LOG4NET-332:
--------------------------------------

Thanks Ron.

I successfully implemented Failover in ADONetAppender. If ADONet fails then it will rollover to FileAppender \ EventViewerAppender. Here I attached the ADONetAppender class file as well.

But I FileAppender I’ll fail, I can’t able to get Logging Event in FileAppender class. Here I’ll explain what scenario I tried. I tried to write a log in a text file but the path I mentioned in the configuration file was wrong, so while writing the log it will search the path to open the file in the method (OpenFile) in FileAppender class file, so in the try catch block I implemented below codes as well,

public override void OpenFile(string filename, bool append,Encoding encoding)
    {
        try
        {
                    m_stream = CreateStream(filename, append, FileShare.Read);
        }
catch (Exception ex)
                {
            LoggingEvent[] events = new LoggingEvent[0];
                    //events = (LoggingEvent[]);

string message = "FileAppender failed to find the path";
                    // Pass the logging event on to the attached appenders if there are any
                    if (iAppenderAttachedImpl != null)
                    {
                            iAppenderAttachedImpl.AppendLoopOnAppenders(events);
                    }
                    else
                    {
                            message += " and there is no appender-ref specified in the configuration for fail-over!";
                    }

                    ErrorHandler.Error(message, ex);
}
}

Could you please advise me on this ASAP?

Thanks
Stalin.M

                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "Ron Grabowski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257221#comment-13257221 ] 

Ron Grabowski commented on LOG4NET-332:
---------------------------------------

If you have general usage questions post to the mailing list. This item is closed because its not a bug in log4net.
                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "stalinsubash (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13256436#comment-13256436 ] 

stalinsubash commented on LOG4NET-332:
--------------------------------------

Thanks Ron.

I successfully implemented Failover in ADONetAppender. If ADONet fails then it will rollover to FileAppender \ EventViewerAppender. Here I attached the ADONetAppender class file as well.

But I FileAppender I’ll fail, I can’t able to get Logging Event in FileAppender class. Here I’ll explain what scenario I tried. I tried to write a log in a text file but the path I mentioned in the configuration file was wrong, so while writing the log it will search the path to open the file in the method (OpenFile) in FileAppender class file, so in the try catch block I implemented below codes as well,

public override void OpenFile(string filename, bool append,Encoding encoding)
	{
		try
		{
                    m_stream = CreateStream(filename, append, FileShare.Read);
		}
catch (Exception ex)
            	{
			LoggingEvent[] events = new LoggingEvent[0];
                	//events = (LoggingEvent[]);

string message = "FileAppender failed to find the path";
                	// Pass the logging event on to the attached appenders if there are any
                	if (iAppenderAttachedImpl != null)
                	{
                    		iAppenderAttachedImpl.AppendLoopOnAppenders(events);
                	}
                	else
                	{
                    		message += " and there is no appender-ref specified in the configuration for fail-over!";
                	}

                	ErrorHandler.Error(message, ex);
}
}

Could you please advise me on this ASAP?

Thanks
Stalin.M

                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Closed] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "Ron Grabowski (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Grabowski closed LOG4NET-332.
---------------------------------

    Resolution: Won't Fix

This isn't a bug in log4net. You need to write your own appender by extending a class like ForwardingAppender:

<appender name="SimpleRolloverForwardingAppender" type="MyCompany.SimpleRolloverForwardingAppender, MyCompany" >
    <appender-ref ref="AdoNetAppender" />
	<appender-ref ref="SmtpAppender" />	
</appender>

You don't need to make any changes to log4net.dll to accomplish what you want.
                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "stalinsubash (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251389#comment-13251389 ] 

stalinsubash commented on LOG4NET-332:
--------------------------------------

Thanks Ron

You mean i need to do some work arround in log4net dll for this ? . Please advise me on this how to do.


                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "stalinsubash (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

stalinsubash reopened LOG4NET-332:
----------------------------------


I need to do some work around in log4net.dll. Please advise me on this ASAP.
                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "Ron Grabowski (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ron Grabowski closed LOG4NET-332.
---------------------------------

    Resolution: Duplicate

See LOG4NET-1
                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LOG4NET-332) I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders

Posted by "Ron Grabowski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4NET-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13251210#comment-13251210 ] 

Ron Grabowski commented on LOG4NET-332:
---------------------------------------

If the AdoNetAppender fails and you switch over to a RollingFileAppender...when do you switch back to the original appender? If/when you switch back to the original appender do you try to re-send captured events? If you want to know if an appender failed you could write a IErrorHandler that sends an email. You could also write a ForwardingAppender that keeps track of a single active appender and rolls to the next one if the first one fails.
                
> I'm looking for the ability to set up a hierarchy of appenders, if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-332
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-332
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.9
>         Environment: windows 7 , VS2010
>            Reporter: stalinsubash
>            Priority: Blocker
>              Labels: patch
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Basically, I'm looking for the ability to set up a hierarchy of appenders so that if a log to an ADONETAppender fails, log4net could then log to one of more "back-up" appenders, for example, a RollingLogFile or SMTP

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira