logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "João Felipe S. Pinto" <j...@jfsp.net>
Subject ASP.NET 2.0 C# - Logging issues with multi layer app.
Date Sat, 15 Mar 2008 01:39:27 GMT
Hello all,

Hope this is an easy stuff to solve due to a newbies misconfig step or 
something.

lemme introduce better my problem

i'm developing a 2-tier app.

tier 1 : Web Site
tier 2: Data Access Layer

i have the log4net config part on the web.config it self.
here it is :
================================================================================
<configuration>
...
<configSections>
    <section name="log4net" 
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
....
<log4net>
        <appender name="RollingLogFileAppender" 
type="log4net.Appender.RollingFileAppender">
            <file value="..\logs\log-file.txt" />
            <appendToFile value="true" />
            <datePattern value="yyyyMMdd" />
            <rollingStyle value="Date" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%-5p %d %5rms %-22.22c{1} 
%-18.18M - %m%n" />
            </layout>
        </appender>
        <root>
            <level value="ALL" />
            <appender-ref ref="RollingLogFileAppender" />
        </root>
    </log4net>
...
<configuration>
================================================================================
as well as the entry at global asax
================================================================================
void Application_Start(object sender, EventArgs e)
    {
        log4net.Config.XmlConfigurator.Configure();
    }
================================================================================

with this done i can perfectly log from the Tier 1(Web Site) here is an 
example:
================================================================================
public partial class UsersList : System.Web.UI.Page
{
  ....
     ILog log = 
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
....
    log.Debug("Calling userDAO.GetAllUsers()");
....
}
================================================================================
but when i try logging on the Tier 2, doesn't do anything at all, not 
even an error.
================================================================================
public partial class userDAO : DAObase
    {
        private static readonly ILog log = 
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
.....
        public DataTable GetAllUsers(out string ErrMsg)
        {
            ErrMsg = String.Empty;
            cmd.CommandText = _queryGetAllUsers;

            log.Debug(MethodBase.GetCurrentMethod().Name + ":" + 
"Connecting to DB");

            cmd.Connection = conn.GetConn();
    .....
         }
......
}
================================================================================

-- 
::::: Now Playing: (Winamp is not active ;-)

João Felipe Santoro Pinto<joao@jfsp.net>

For more Info check my vCard attached


Mime
View raw message