Watch the log!

xBIM uses Log4Net to log processing errors and warnings where exceptions are not appropriate. It is heavily used in xBIM Geometry Engine to log all geometry errors. If you have a file which doesn't look quite right you should always check the log first. There are many possible configurations of Log4Net including logging to console, creating continuous or rolling log file and others. Some examples can be found here. The most basic configuration which will write all colourful log messages in console can look like this:

<?xml version="1.0" encoding="utf-8" ?>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <!-- Defines default logging behaviour -->
      <appender-ref ref="console" />
      <!-- Set the default logging level to one of ALL DEBUG INFO WARN ERROR FATAL NONE -->
      <level value="ALL" />
    <appender name="console" type="log4net.Appender.ColoredConsoleAppender">
        <level value="FATAL" />
        <foreColor value="White" />
        <backColor value="Red" />
        <level value="ERROR" />
        <foreColor value="Red, HighIntensity" />
        <level value="WARN" />
        <foreColor value="Green, HighIntensity" />
        <level value="INFO" />
        <foreColor value="Blue, HighIntensity" />
        <level value="DEBUG" />
        <foreColor value="White" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%-5level - %message  [%logger %type.%method Line %line]%newline" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

You can also use xBIM infrastructure to log your own messages like this:

using Xbim.Common.Logging;
var log = LoggerFactory.GetLogger(); 

log.Info("Examples are just about to start.");
log.Warn("Always use LINQ instead of general iterations!");
log.Error("This is how the error would be logged with log4net.");
log.Info("All examples finished.");

Some of the companies using xBIM Toolkit: