locked
Log Info with log4net RRS feed

  • Question

  • User-1811822114 posted

    I'm using log4net to maintain an exceptions log of an application. I realized that the log info shows the file path of the development environment even thought it's not published in the same machine and location.

    e.g.:

    {System.NullReferenceException: Object reference not set to an instance of an object.
    at MyProjectNamespace.MyProject.MyPage.Page_Load(Object sender, EventArgs e) in C:\Users\MySolutionFolder\TestePage.aspx.cs:line 47}

    I'd like to know how to set up the application and/or log4net to display the location where then application is hosted.

    Monday, May 6, 2013 12:24 PM

Answers

  • User-166373564 posted

    Hi JanainaML

    how to set up the application and/or log4net to display the location where then application is hosted.

    If you want to set up an asp.net application on IIS, please follow the general steps below,

    1.create a new site from left menu By right clicking and add new website.

    2.Give physical path to that folder

    3.Map with the site url

    4.Give permissions to Directory as

    5.Set up the default page

    6.Set framework which ever you are using.

    If you have any problems about Log4Net, please ask this question in Log4Net forum:

    http://old.nabble.com/Log4net-f14324.html

    With regards

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 13, 2013 2:58 AM

All replies

  • User1320044578 posted

    Can you post your code to config log4net in your application.

    I think it is logging currect path because it doesn't require to set application path. 

    Monday, May 6, 2013 1:02 PM
  • User-1811822114 posted

    Here's the web.config node for log4net:

    <log4net>

    <root>
    <level value="DEBUG" />
    <appender-ref ref="LogFileAppender" />
    </root>
    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
    <param name="File" value="LOG\log.txt" />
    <param name="AppendToFile" value="true" />
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="10" />
    <maximumFileSize value="10MB" />
    <staticLogFileName value="true" />
    <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} – %m%n" />
    </layout>
    </appender>
    </log4net>

    I've realized that the Exception.ToString() is the problem, I've published a test page that throwed the exception in the screen and it also brought the development enviroment's path.

    Monday, May 6, 2013 2:00 PM
  • User-166373564 posted

    Hi JanainaML

    how to set up the application and/or log4net to display the location where then application is hosted.

    If you want to set up an asp.net application on IIS, please follow the general steps below,

    1.create a new site from left menu By right clicking and add new website.

    2.Give physical path to that folder

    3.Map with the site url

    4.Give permissions to Directory as

    5.Set up the default page

    6.Set framework which ever you are using.

    If you have any problems about Log4Net, please ask this question in Log4Net forum:

    http://old.nabble.com/Log4net-f14324.html

    With regards

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 13, 2013 2:58 AM