Ticket T551808
Visible to All Users

XAF Logging with log4net

created 8 years ago

Hi I have implemented my own trace listener  with log4net as suggested in
https://www.devexpress.com/Support/Center/Question/Details/Q234241/tracing-write-log-messages-to-database

and it works fine.
However the devexpress log file "eXpressAppFramework.log" is still created.

If I configure the switch
<add name="eXpressAppFramework" value="0"/>
to zero the file is not created, but there are also no traces logged to the trace listener obviously.

So how can one use a custom trace listener and prevent the defult log file from creating?

Answers approved by DevExpress Support

created 7 years ago

Hi Patrick,

Call the Tracing.Initialize method with an empty string parameter to suppress the default TraceListener creation. This should be done before an XafApplication instance is created, because otherwise, the default listener will be initialized, and the XAF log file will be created. Here is an example:

C#
public static void Main(string[] arguments) { ... Trace.Listeners.Add(new TextWriterTraceListener("test.log")); Tracing.Initialize(String.Empty); MainDemoWinApplication winApplication = new MainDemoWinApplication();

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.