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 Wed, 07 Jan 2015 12:56:38 GMT
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
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