Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Goyal, Nitin   UTAS

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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Dominik Psenner

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:[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Goyal, Nitin   UTAS

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:[hidden email]]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: [hidden email]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

AW: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Dominik Psenner

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:[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 13:57
An: Log4NET User
Cc: [hidden email]
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 [[hidden email]]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: [hidden email]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Goyal, Nitin   UTAS

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:[hidden email]]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 13:57
An: Log4NET User
Cc: [hidden email]
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 [[hidden email]]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: [hidden email]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

AW: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Dominik Psenner

Great to hear that you’ve got sorted it out! Would you like to share more details on the problems and how you solved them? This information might become handy to future readers who run into a similar issue.

 

Cheers

 

Von: Goyal, Nitin UTAS [mailto:[hidden email]]
Gesendet: Donnerstag, 08. Jänner 2015 11:45
An: Log4NET User
Betreff: RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

 

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 [[hidden email]]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 13:57
An: Log4NET User
Cc: [hidden email]
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 [[hidden email]]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: [hidden email]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.

 

Reply | Threaded
Open this post in threaded view
|

RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

Goyal, Nitin   UTAS

Sure.

 

The issue was that the Regional Settings of the Win8 machine with new Visual Studio were different from Win7 machine and thus the path  given by the log4net to log the file was having the  “/” in date (which was part of the log file name) which caused the issued and it was not able to locate the proper path to put the file.

 

Resolving that “/” with proper replacement made that work.

 

So, the issue was not with log4net but the path and the regional settings of the machine and taking the deeper look into the internal logs of the log4net made the things clearer.

 

Regards

Nitin

 

From: Dominik Psenner [mailto:[hidden email]]
Sent: 08 January 2015 16:48
To: 'Log4NET User'
Subject: AW: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

 

Great to hear that you’ve got sorted it out! Would you like to share more details on the problems and how you solved them? This information might become handy to future readers who run into a similar issue.

 

Cheers

 

Von: Goyal, Nitin UTAS [[hidden email]]
Gesendet: Donnerstag, 08. Jänner 2015 11:45
An: Log4NET User
Betreff: RE: [External] AW: Log4Net RollingFileAppender not adding Custom property in Win8/VS2013

 

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 [[hidden email]]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 13:57
An: Log4NET User
Cc: [hidden email]
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 [[hidden email]]
Sent: 07 January 2015 17:36
To: 'Log4NET User'
Cc: [hidden email]
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 [[hidden email]]
Gesendet: Mittwoch, 07. Jänner 2015 11:23
An: [hidden email]
Cc: [hidden email]
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

[hidden email]    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.