Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/14/11 16:45:46 (13 years ago)
Author:
abeham
Message:

#1465

  • updated branch with latest version of trunk
Location:
branches/histogram
Files:
5 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • branches/histogram

  • branches/histogram/HeuristicLab.Tracing/3.3/HeuristicLab.Tracing-3.3.csproj

    r5163 r6195  
    9696  </PropertyGroup>
    9797  <ItemGroup>
    98     <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
    99       <SpecificVersion>False</SpecificVersion>
    100       <HintPath>..\..\HeuristicLab.ExtLibs\HeuristicLab.log4net\1.2.10.0\log4net.dll</HintPath>
    101     </Reference>
    10298    <Reference Include="System" />
    10399    <Reference Include="System.Core">
     
    115111  <ItemGroup>
    116112    <None Include="HeuristicLabTracingPlugin.cs.frame" />
    117     <Compile Include="HiveLogger.cs" />
     113    <Compile Include="HeuristicLabTracingPlugin.cs" />
    118114    <Compile Include="Logger.cs" />
    119     <Compile Include="HeuristicLabTracingPlugin.cs" />
    120115    <Compile Include="Properties\AssemblyInfo.cs" />
    121     <Compile Include="Properties\Settings.Designer.cs">
    122       <AutoGen>True</AutoGen>
    123       <DesignTimeSharedInput>True</DesignTimeSharedInput>
    124       <DependentUpon>Settings.settings</DependentUpon>
    125     </Compile>
    126116  </ItemGroup>
    127117  <ItemGroup>
    128     <ProjectReference Include="..\..\HeuristicLab.ExtLibs\HeuristicLab.log4net\1.2.10.0\HeuristicLab.log4net-1.2.10.0.csproj">
    129       <Project>{1B3063DB-D71C-4A6A-A359-883E8F53A140}</Project>
    130       <Name>HeuristicLab.log4net-1.2.10.0</Name>
    131     </ProjectReference>
    132118    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    133119      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     
    139125    <None Include="HeuristicLab.snk" />
    140126    <None Include="Properties\AssemblyInfo.frame" />
    141     <None Include="Properties\Settings.settings">
    142       <Generator>SettingsSingleFileGenerator</Generator>
    143       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    144     </None>
    145     <Content Include="HeuristicLab.log4net.xml">
    146       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    147     </Content>
    148   </ItemGroup>
    149   <ItemGroup>
    150     <Content Include="HeuristicLab.Hive.log4net.xml">
    151       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    152     </Content>
    153127  </ItemGroup>
    154128  <ItemGroup>
  • branches/histogram/HeuristicLab.Tracing/3.3/HeuristicLabTracingPlugin.cs.frame

    r5446 r6195  
    2727  /// HeuristicLab Tracing Plugin
    2828  /// </summary> 
    29   [Plugin("HeuristicLab.Tracing", "3.3.3.$WCREV$")]
     29  [Plugin("HeuristicLab.Tracing", "3.3.4.$WCREV$")]
    3030  [PluginFile("HeuristicLab.Tracing-3.3.dll", PluginFileType.Assembly)]
    31   [PluginFile("HeuristicLab.log4net.xml", PluginFileType.Data)]
    32   [PluginDependency("HeuristicLab.log4net", "1.2.10.0")]
    3331  public class HeuristicLabPersistencePlugin : PluginBase {}
    3432
  • branches/histogram/HeuristicLab.Tracing/3.3/Logger.cs

    r5445 r6195  
    2020#endregion
    2121
     22
    2223using System;
    2324using System.Diagnostics;
    24 using System.IO;
    25 using HeuristicLab.Tracing.Properties;
    26 using log4net;
    27 using log4net.Config;
    28 
    2925namespace HeuristicLab.Tracing {
    3026
    3127  /// <summary>
    32   /// HeuristicLab Tracing entry point. Default logger. Reads configured tracing
    33   /// file and provides automatic logging with reflection of the calling type.
     28  /// HeuristicLab.Tracing using System.Diagnostics.Trace.
     29  /// Note that tracing is only activated if the DEBUG or TRACE symbol is set.
     30  /// Configuration (type of listener, file name, ...) is done in app.config in the <system.diagnostics> section.
    3431  /// </summary>
    3532  public class Logger {
    3633
    3734    /// <summary>
    38     /// true if Configure has been called already.
     35    /// Issues a debug message.
    3936    /// </summary>
    40     protected static bool IsConfigured = false;
    41 
    42     /// <summary>
    43     /// Configures this instance: Reads the log file specified in the settings.
    44     /// </summary>
    45     protected static void Configure() {
    46       if (IsConfigured) return;
    47       IsConfigured = true;
    48       if (string.IsNullOrEmpty(Settings.Default.TracingLog4netConfigFile)) {
    49         Settings.Default.TracingLog4netConfigFile =
    50             "HeuristicLab.log4net.xml";
    51       }
    52       XmlConfigurator.ConfigureAndWatch(
    53         new FileInfo(Settings.Default.TracingLog4netConfigFile));
    54       Info("logging initialized " + DateTime.Now);
     37    /// <param name="message">The message.</param>
     38    public static void Debug(object message) {
     39      StackFrame frame = new StackFrame(1);
     40      Trace.TraceInformation("{0} - {1}", frame.GetMethod().DeclaringType, message);
    5541    }
    5642
    5743    /// <summary>
    58     /// Gets the default logger for the calling class n levels up in the
    59     /// call hierarchy.
     44    /// Issues an informational message.
    6045    /// </summary>
    61     /// <param name="nParents">The number of parent calls.</param>
    62     /// <returns>An <see cref="ILog"/> instance.</returns>
    63     public static ILog GetDefaultLogger(int nParents) {
    64       Configure();
    65       StackFrame frame = new StackFrame(nParents + 1);
    66       return LogManager.GetLogger(frame.GetMethod().DeclaringType);
     46    /// <param name="message">The message.</param>
     47    public static void Info(object message) {
     48      StackFrame frame = new StackFrame(1);
     49      Trace.TraceInformation("{0} - {1}", frame.GetMethod().DeclaringType, message);
    6750    }
    6851
    6952    /// <summary>
    70     /// Gets the default logger: The logger for the class of the
    71     /// calling method.
     53    /// Issues a warning message.
    7254    /// </summary>
    73     /// <returns>An <see cref="ILog"/> instance.</returns>
    74     public static ILog GetDefaultLogger() {
    75       Configure();
     55    /// <param name="message">The message.</param>
     56    public static void Warn(object message) {
    7657      StackFrame frame = new StackFrame(1);
    77       return LogManager.GetLogger(frame.GetMethod().DeclaringType);
     58      Trace.TraceWarning("{0} - {1}", frame.GetMethod().DeclaringType, message);
    7859    }
    7960
    8061    /// <summary>
    81     /// Issues a debug message to the default logger.
     62    /// Issues an error message.
    8263    /// </summary>
    8364    /// <param name="message">The message.</param>
    84     public static void Debug(object message) {
    85       GetDefaultLogger(1).Debug(message);
     65    public static void Error(object message) {
     66      StackFrame frame = new StackFrame(1);
     67      Trace.TraceError("{0} - {1}", frame.GetMethod().DeclaringType, message);
    8668    }
    8769
    8870    /// <summary>
    89     /// Issues an informational message to the default logger.
    90     /// </summary>
    91     /// <param name="message">The message.</param>
    92     public static void Info(object message) {
    93       GetDefaultLogger(1).Info(message);
    94     }
    95 
    96     /// <summary>
    97     /// Issues a warning message to the default logger.
    98     /// </summary>
    99     /// <param name="message">The message.</param>
    100     public static void Warn(object message) {
    101       GetDefaultLogger(1).Warn(message);
    102     }
    103 
    104     /// <summary>
    105     /// Issues an error message to the default logger.
    106     /// </summary>
    107     /// <param name="message">The message.</param>
    108     public static void Error(object message) {
    109       GetDefaultLogger(1).Error(message);
    110     }
    111 
    112     /// <summary>
    113     /// Issues a fatal error message to the default logger.
    114     /// </summary>
    115     /// <param name="message">The message.</param>
    116     public static void Fatal(object message) {
    117       GetDefaultLogger(1).Fatal(message);
    118     }
    119 
    120     /// <summary>
    121     /// Issues a debug message to the logger of the specified type.
     71    /// Issues a debug message of the specified type.
    12272    /// </summary>
    12373    /// <param name="type">The type.</param>
    12474    /// <param name="message">The message.</param>
    12575    public static void Debug(Type type, object message) {
    126       Configure();
    127       LogManager.GetLogger(type).Debug(message);
     76      Trace.TraceInformation("{0}: {1}", type, message);
    12877    }
    12978
    13079    /// <summary>
    131     /// Issues an iformational message to the logger of the specified
    132     /// type.
     80    /// Issues an informational message of the specified type.
    13381    /// </summary>
    13482    /// <param name="type">The type.</param>
    13583    /// <param name="message">The message.</param>
    13684    public static void Info(Type type, object message) {
    137       Configure();
    138       LogManager.GetLogger(type).Info(message);
     85      Trace.TraceInformation("{0}: {1}", type, message);
    13986    }
    14087
    14188    /// <summary>
    142     /// Issues a warning message to the logger of
    143     /// the specified type.
     89    /// Issues a warning message of the specified type.
    14490    /// </summary>
    14591    /// <param name="type">The type.</param>
    14692    /// <param name="message">The message.</param>
    14793    public static void Warn(Type type, object message) {
    148       Configure();
    149       LogManager.GetLogger(type).Warn(message);
     94      Trace.TraceWarning("{0}: {1}", type, message);
    15095    }
    15196
    15297    /// <summary>
    153     /// Issues an error message to the logger of the specified
    154     /// type.
     98    /// Issues an error message of the specified type.
    15599    /// </summary>
    156100    /// <param name="type">The type.</param>
    157101    /// <param name="message">The message.</param>
    158102    public static void Error(Type type, object message) {
    159       Configure();
    160       LogManager.GetLogger(type).Error(message);
     103      Trace.TraceError("{0}: {1}", type, message);
    161104    }
    162105
    163106    /// <summary>
    164     /// Issues a fatal error message to the logger of
    165     /// the specified type.
    166     /// </summary>
    167     /// <param name="type">The type.</param>
    168     /// <param name="message">The message.</param>
    169     public static void Fatal(Type type, object message) {
    170       Configure();
    171       LogManager.GetLogger(type).Fatal(message);
    172     }
    173 
    174     /// <summary>
    175     /// Issues a debug message to the default
    176     /// logger including an exception.
     107    /// Issues a debug message including an exception.
    177108    /// </summary>
    178109    /// <param name="message">The message.</param>
    179110    /// <param name="exception">The exception.</param>
    180111    public static void Debug(object message, Exception exception) {
    181       GetDefaultLogger(1).Debug(message, exception);
     112      Trace.TraceInformation("{0}: {1}:", message, exception);
    182113    }
    183114
    184115    /// <summary>
    185     /// Issues an informational message to the default
    186     /// logger including an exception.
     116    /// Issues an informational message including an exception.
    187117    /// </summary>
    188118    /// <param name="message">The message.</param>
    189     /// <param name="exception">The exception.</param>
    190 
     119    /// <param name="exception">The exception.</param>       
    191120    public static void Info(object message, Exception exception) {
    192       GetDefaultLogger(1).Info(message, exception);
     121      Trace.TraceInformation("{0}: {1}:", message, exception);
    193122    }
    194123
    195124    /// <summary>
    196     /// Issues a warning message to the default
    197     /// logger including an exception.
     125    /// Issues a warning message including an exception.
    198126    /// </summary>
    199127    /// <param name="message">The message.</param>
    200128    /// <param name="exception">The exception.</param>
    201129    public static void Warn(object message, Exception exception) {
    202       GetDefaultLogger(1).Warn(message, exception);
     130      Trace.TraceWarning("{0}: {1}:", message, exception);
    203131    }
    204132
    205133    /// <summary>
    206     /// Issues an error message to the default
    207     /// logger including an exception.
     134    /// Issues an error message including an exception.
    208135    /// </summary>
    209136    /// <param name="message">The message.</param>
    210137    /// <param name="exception">The exception.</param>
    211138    public static void Error(object message, Exception exception) {
    212       GetDefaultLogger(1).Error(message, exception);
     139      Trace.TraceError("{0}: {1}:", message, exception);
    213140    }
    214141
    215142    /// <summary>
    216     /// Issues a fatal error message to the default
    217     /// logger including an exception.
    218     /// </summary>
    219     /// <param name="message">The message.</param>
    220     /// <param name="exception">The exception.</param>
    221     public static void Fatal(object message, Exception exception) {
    222       GetDefaultLogger(1).Fatal(message, exception);
    223     }
    224 
    225     /// <summary>
    226     /// Issues a debug message to the logger of the specified
    227     /// type including an exception.
     143    /// Issues a debug message of the specified type including an exception.
    228144    /// </summary>
    229145    /// <param name="type">The type.</param>
     
    231147    /// <param name="exception">The exception.</param>
    232148    public static void Debug(Type type, object message, Exception exception) {
    233       Configure();
    234       LogManager.GetLogger(type).Debug(message, exception);
     149      Trace.TraceInformation("{0}: {1}: {2}", type, message, exception);
    235150    }
    236151
    237152    /// <summary>
    238     /// Issues an informational message to the logger of the specified
    239     /// type including an exception.
     153    /// Issues an informational message of the specified type including an exception.
    240154    /// </summary>
    241155    /// <param name="type">The type.</param>
     
    243157    /// <param name="exception">The exception.</param>
    244158    public static void Info(Type type, object message, Exception exception) {
    245       Configure();
    246       LogManager.GetLogger(type).Info(message, exception);
     159      Trace.TraceInformation("{0}: {1}: {2}", type, message, exception);
    247160    }
    248161
    249162    /// <summary>
    250     /// Issues a warning message to the logger of the specified
    251     /// type including an exception.
     163    /// Issues a warning message of the specified type including an exception.
    252164    /// </summary>
    253165    /// <param name="type">The type.</param>
     
    255167    /// <param name="exception">The exception.</param>
    256168    public static void Warn(Type type, object message, Exception exception) {
    257       Configure();
    258       LogManager.GetLogger(type).Warn(message, exception);
     169      Trace.TraceWarning("{0}: {1}: {2}", type, message, exception);
    259170    }
    260171
    261172    /// <summary>
    262     /// Issues an error message to the logger of the specified
    263     /// type including an exception.
     173    /// Issues an error message of the specified type including an exception.
    264174    /// </summary>
    265175    /// <param name="type">The type.</param>
     
    267177    /// <param name="exception">The exception.</param>
    268178    public static void Error(Type type, object message, Exception exception) {
    269       Configure();
    270       LogManager.GetLogger(type).Error(message, exception);
    271     }
    272 
    273     /// <summary>
    274     /// Issues a fatal error message to the logger of the specified
    275     /// type including an exception.
    276     /// </summary>
    277     /// <param name="type">The type.</param>
    278     /// <param name="message">The message.</param>
    279     /// <param name="exception">The exception.</param>
    280     public static void Fatal(Type type, object message, Exception exception) {
    281       Configure();
    282       LogManager.GetLogger(type).Fatal(message, exception);
     179      Trace.TraceError("{0}: {1}: {2}", type, message, exception);
    283180    }
    284181  }
  • branches/histogram/HeuristicLab.Tracing/3.3/Properties/AssemblyInfo.frame

    r5446 r6195  
    5252//
    5353[assembly: AssemblyVersion("3.3.0.0")]
    54 [assembly: AssemblyFileVersion("3.3.3.$WCREV$")]
     54[assembly: AssemblyFileVersion("3.3.4.$WCREV$")]
  • branches/histogram/HeuristicLab.Tracing/3.3/app.config

    r5163 r6195  
    11<?xml version="1.0"?>
    2 <configuration>
    3   <configSections>   
    4     <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    5       <section name="HeuristicLab.Tracing.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
    6     </sectionGroup>
    7   </configSections>
    8   <userSettings>
    9     <HeuristicLab.Tracing.Properties.Settings>
    10       <setting name="TracingLog4netConfigFile" serializeAs="String">
    11         <value/>
    12       </setting>
    13     </HeuristicLab.Tracing.Properties.Settings>
    14   </userSettings>
     2<configuration>       
     3  <system.diagnostics>
     4    <trace autoflush="true" indentsize="4">
     5      <listeners>
     6        <add name="HeuristicLabListener"
     7          type="System.Diagnostics.TextWriterTraceListener"
     8          initializeData="HeuristicLab.log" />
     9        <remove name="Default" />
     10      </listeners>
     11    </trace>
     12  </system.diagnostics>
    1513<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Note: See TracChangeset for help on using the changeset viewer.