Skip to main content
A newer version of this page is available. .

Log Files

  • 6 minutes to read

The Log file records all system and end-user operations during the runtime of an application. Examples of system operations are: loading the model, generating the default model for actions and property editors, and loading model differences. The most common end-user operation is executing an action - pressing a toolbar button, etc. If any operation leads to an error or an exception, the corresponding information is also written to a log file. So, if a problem occurs, the log file makes it easy to track the cause. If you cannot resolve an issue yourself, you can send a log file to our Support Center, to get assistance from Developer Express support engineers.

Log files are not re-written each time you run an application. The new content is added below the previously logged information. Therefore, you can analyze multiple application runs, if needed.

XAF tracing mechanism relies on the standard .NET logging APIs from the System.Diagnostics and related namespaces. By default, the TextWriterTraceListener class writes all application events into the eXpressAppFramework.log file by means of the DevExpress.Persistent.Base.Tracing class. The latter is technically a wrapper above the standard trace listeners. To see how to customize this default tracing mechanism, refer to the MSDN articles linked above and to the Add Custom Log Entries and Customize the Default Tracer Behavior topic.

Log Files Generated at Runtime

The eXpressApp Framework can produce the Windows Forms and ASP.NET applications based on the same logic. Each application has its own log file.

The log file location is specified in the application configuration file, by the TraceLogLocation attribute. The following snippet illustrates this.

<configuration>
    <appSettings>
        <!-- ... -->
        <add key="TraceLogLocation" value="ApplicationFolder"/>

The possible TraceLogLocation values are:

Value Description
ApplicationFolder The log file is saved to the application folder. The Windows Forms application saves the log file to a folder where the application executable is located. The ASP.NET applications save the log file to a folder where the default.aspx file is located. Ensure that the system account used to run the application has a write permission to this folder.
CurrentUserApplicationDataFolder The log file is saved to the current user ApplicationData folder. In effect for Windows Forms applications only.
None Logging is disabled. It is recommended to use this value in the production environment because there is no log rotation mechanism in XAF.

The default log file name is eXpressAppFramework.log. To specify another Windows Forms application log file, open the Program.cs (Program.vb) file located in the Windows Forms application project. Set the LogName property of the Tracing class in the Main method, before an XAF Application object is instantiated. The following code snippet illustrates this.

static class Program {
    // ...
    static void Main() {
        Tracing.LogName = "CustomLogFile";
        // ...
        MySolutionWindowsFormsApplication winApplication = 
            new MySolutionWindowsFormsApplication();
        //...

To specify another ASP.NET application log file, open the Global.asax.cs (Global.asax.vb) file located in the ASP.NET application project. Set the LogName property of the Tracing class in the Session_Start event handler, before an XAF Application object is instantiated. The following code snippet illustrates this.

public class Global : System.Web.HttpApplication {
    // ...        
    protected void Session_Start(Object sender, EventArgs e) {
        Tracing.LogName = "CustomLogFile";
        // ...
        WebApplication.SetInstance(Session, new MySolutionAspNetApplication());
        // ...

The “.log“ extension is added automatically.

You can also specify the log file relative path or absolute path in a similar manner. For instance, you can set the Tracing.LogName property to “Logs\CustomLogFile” or “C:\Logs\CustomLogFile”. Ensure that the specified location is accessible. Otherwise, the log file will not be created.

Note

If an attempt is made to write to a log file that is in use, the file name is automatically prefixed by a GUID (Globally Unique Identifier). For instance, it is possible when several XAF applications are running simultaneously. To avoid prefixes, specify a custom log file name for each application.

Logging Detail Level

You can control the detail level of information written into an application log file.

You can specify five different detail levels:

Level Description
0 Logging is disabled.
1 Only errors are logged.
2 Errors and warning messages are written into the log file.
3 In addition to the previous messages, the system logs detected operations executed by the system, or end-users.
4 Use this level to create the most detailed log files. All Security System loggers (Permission Processors, Middle Tier loggers, security rule loggers) are enabled in this mode.
  • For the .NET Framework projects:

    Edit the content of the <system.diagnostics> tag within the App.config (for a Windows Forms application) or Web.config file (for a ASP.NET Web application). This tag has two entries - one for the eXpressApp Framework itself, and another that controls how eXpress Persistent Objects logs its operations. For both these entries, you can specify detail levels

    <configuration>
    <system.diagnostics>
        <switches>
            <add name="eXpressAppFramework" value="4" />
            <!--<add name="XPO" value="4" />-->
        </switches>
    </system.diagnostics>
    </configuration>
    
  • For .NET Core projects:

    Edit the content of the <appSettings> tag within the App.config file.

    <configuration>
    <!-- ... -->
        <appSettings>
        <!-- ... -->
            <add key="eXpressAppFrameworkTraceLevel" value="4"/>
        </appSettings>
    </configuration>
    

In addition to information written to log files by the system, you can also manually write diagnostics information to log files. To accomplish this, use static methods available via the static DevExpress.Persistent.Base.Tracing.Tracer property. For details on these logging methods, see Add Custom Log Entries and Customize the Default Tracer Behavior.

Log Files Generated for Designers

While working on an XAF application, you may face problems in loading the Application Designer, Module Designer and Model Editor. For any of these designers, log files are generated. Information written to these log files may help you solve the problems raised.

Application Designer

  • <SolutionName>.Win\<ApplicationClassName>.Designer.log
  • <SolutionName>.Web\<ApplicationClassName>.Designer.log

Module Designer

  • <SolutionName>.Module\<ModuleClassName>.Designer.log
  • <SolutionName>.Module.Win\<ModuleClassName>.Designer.log
  • <SolutionName>.Module.Web\<ModuleClassName>.Designer.log

Model Editor (All Platforms)

  • <SolutionName>.Module\Model.DesignedDiffs.log
  • <SolutionName>.Module.Win\Model.DesignedDiffs.log
  • <SolutionName>.Module.Web\Model.DesignedDiffs.log
  • <SolutionName>.Module.Blazor\Model.DesignedDiffs.log
  • <SolutionName>.Win\Model.log
  • <SolutionName>.Web\Model.log
  • <SolutionName>.Blazor.Server\Model.log

Model Editor (.NET Core/.NET Standard)

All files in the %USERPROFILE%\AppData\Roaming\eXpressAppFramework\ folder.

See Also