logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goyal, Nitin UTAS" <Nitin.Go...@utas.utc.com>
Subject RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013
Date Thu, 08 Jan 2015 10:44:49 GMT
Thanks mate for the insight.

I got it solved by looking at the log files of the log4net and the issue was in the naming
and some regional setting of the machine with Win8.

Regards
Nitin

From: Dominik Psenner [mailto:dpsenner@gmail.com]
Sent: 07 January 2015 18:44
To: 'Log4NET User'
Subject: AW: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Given that you've already enabled and checked log4net's internal debug logs, would you mind
sharing these logs with us? The next best bet I can come up with is that you step through
the application with the debugger right from the point where you set up the property and invoke
log4net.Config.XmlConfigurator.Configure(). You could even step through a second instance
that runs on win7 at the same time. This way you would literally see where the instances branch.

Cheers

Von: Goyal, Nitin UTAS [mailto:Nitin.Goyal@utas.utc.com]
Gesendet: Mittwoch, 07. Jänner 2015 13:57
An: Log4NET User
Cc: nitinkumgoyal@gmail.com<mailto:nitinkumgoyal@gmail.com>
Betreff: RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Thanks

I have checked all this stuff and this all working in Win7 perfectly.

The only issue is when I try to run the same code on Win8 with VS2013 and it don't use that
property and create alone the file name as the datetime and not the static value I have added.
It's very surprising and I am banging my head what changes are doing this to happen. :/

Regards
Nitin

From: Dominik Psenner [mailto:dpsenner@gmail.com]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: nitinkumgoyal@gmail.com<mailto:nitinkumgoyal@gmail.com>
Subject: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Howdie,

Here's a list of things that you could check:


*         First of all enable log4net's internal debug logging, it may give you a clue what
he is doing

*         Make sure to call log4net.Config.XmlConfigurator.Configure() after setting the property

*         Escape path separators properly

*         Specify the rolling style to be used

Beware that using a patternstring for  the file property of a rollingfileappender is a hot
hack and you might get burned as soon as rolling jumps in!

Cheers

Von: Goyal, Nitin UTAS [mailto:Nitin.Goyal@utas.utc.com]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: log4net-user@logging.apache.org<mailto:log4net-user@logging.apache.org>
Cc: nitinkumgoyal@gmail.com<mailto:nitinkumgoyal@gmail.com>
Betreff: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Hi All
I am creating a custom property in Log4Net with Visual Studio 2010 on Win7 and it is able
to create everything well with the correct property. But If i try to run the same program
on Win8 and Visual Studio 2013, it do create the log file but without the custom property.
I have not edited anything and same thing is working in WIn7 but not in Win8.
I don't know what is changing in both of these environments. Can anyone give hint at what
to look for?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net"     type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"
/>
  </configSections>
  <log4net>
  <appender name="CsvFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
    <file type="log4net.Util.PatternString" value="C:\TSAS_DRU_Log\%property{LogName}"
/>
    <appendToFile value="true"/>
    <maxSizeRollBackups value="10"/>
    <maximumFileSize value="100MB"/>
    <staticLogFileName value="true"/>
    <layout type="TSAS_DRU_app.CsvPatternLayout, TSAS_DRU_app">
    </layout>
  </appender>
  <root>
    <level value="DEBUG" />
    <appender-ref ref="CsvFileAppender" />
  </root>
</log4net>
  </configuration>

I am setting the property in the code as following which is working correctly in WIn7 but
not in Win8 where I have just updated the Visual studio as version 2013 with 2010:
string LogName = "TSAS_DRU_Log_" + date + ".csv";
    log4net.GlobalContext.Properties["LogName"] = LogName;


Nitin Goyal - Technical Lead, Software - Sensors & Integrated Systems
UTC AEROSPACE SYSTEMS
Netra Tech Park, Old Plot No.181, New Plot No. 40, EPIP Industrial Area, Part of Sy.No.28,
Kundalahalli Village, Krishnaraja Puram Hobli, Bangalore 560 066, Karnataka, India
Tel: +91 80 673 80262  Mobile: +91 9886295724  Fax: +91 80 673 80005
nitin.goyal@utas.utc.com<mailto:naveen.hiriyannaiah@utas.utc.com>    www.utcaerospacesystems.com<http://www.utcaerospacesystems.com/>

CONFIDENTIALITY WARNING:  This message may contain proprietary and/or privileged information
of UTC Aerospace Systems and its affiliated companies.  If you are not the intended recipient,
please 1) do not disclose, copy, distribute or use this message or its contents, 2) advise
the sender by return e-mail, and 3) delete all copies (including all attachments) from your
computer.  Your cooperation is greatly appreciated.


Mime
View raw message