Configuring Logging when the Connector is Installed Locally
less than a minute
Note: If the Connector is installed in a DXP cloud environment, see Configuring Logging in DXP Environments
In an environment where the Connector is installed locally, you can activate full verbose logging for it. This is useful for identifying errors.
To configure logging:
- Append the following to
log4net.config
:
<appender name="lionbridgeFileLogAppender" type="log4net.Appender.RollingFileAppender" >
<!-- Consider moving the log files to a location outside the web application -->
<file value="App_Data\LionbridgeErrors.log" />
<encoding value="utf-8" /> <staticLogFileName value="true"/> <datePattern value=".yyyyMMdd.'log'" /> <rollingStyle value="Date" /> <threshold value="Verbose" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"
/>
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger:
%message%n" />
</layout>
</appender>
- Add the following logger:
</logger>
<logger name="Lionbridge" additivity="false">
<level value="Verbose" />
<appender-ref ref="lionbridgeFileLogAppender" />
</logger>
The generated log file is:\App_Data\LionbridgeErrors.log
.
-
Add the logging setting for Log4Net into appsettings.json.
-
Configure Logging for Log4Net: Add the AddLog4Net() call into your
Configure
method of theProgram
class.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureCmsDefaults() .ConfigureLogging(builder => { builder.ClearProviders(); builder.AddLog4Net(); })
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});