Log4net 1.2.10.0 [top] (2026)

private static readonly ILog log = LogManager.GetLogger(typeof(OrderService));

if (log.IsDebugEnabled) log.Debug($"Processing order orderId"); try // Business logic here log.Info($"Order orderId processed successfully"); catch (Exception ex) log.Error($"Failed to process order orderId", ex); throw; log4net 1.2.10.0

[assembly: log4net.Config.XmlConfigurator(Watch = true)] Or at application startup: private static readonly ILog log = LogManager

log4net.ThreadContext.Properties["UserId"] = currentUser.Id; log.Info("User action logged with context"); log.Info("User action logged with context")

using (log4net.ThreadContext.Stacks["NDC"].Push("TransactionScope"))

Events.Add(loggingEvent);

public class CustomMemoryAppender : log4net.Appender.AppenderSkeleton