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

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: