Changeset 6173
- Timestamp:
- 05/10/11 12:24:33 (14 years ago)
- Location:
- trunk
- Files:
-
- 3 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj
r5698 r6173 110 110 <SpecificVersion>False</SpecificVersion> 111 111 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath> 112 </Reference>113 <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">114 <SpecificVersion>False</SpecificVersion>115 <HintPath>..\..\HeuristicLab.ExtLibs\HeuristicLab.log4net\1.2.10.0\log4net.dll</HintPath>116 112 </Reference> 117 113 <Reference Include="System" /> -
trunk/sources/HeuristicLab.Tracing/3.3/HeuristicLab.Tracing-3.3.csproj
r5163 r6173 96 96 </PropertyGroup> 97 97 <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>102 98 <Reference Include="System" /> 103 99 <Reference Include="System.Core"> … … 115 111 <ItemGroup> 116 112 <None Include="HeuristicLabTracingPlugin.cs.frame" /> 117 <Compile Include="H iveLogger.cs" />113 <Compile Include="HeuristicLabTracingPlugin.cs" /> 118 114 <Compile Include="Logger.cs" /> 119 <Compile Include="HeuristicLabTracingPlugin.cs" />120 115 <Compile Include="Properties\AssemblyInfo.cs" /> 121 116 <Compile Include="Properties\Settings.Designer.cs"> … … 126 121 </ItemGroup> 127 122 <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>132 123 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 133 124 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> … … 143 134 <LastGenOutput>Settings.Designer.cs</LastGenOutput> 144 135 </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>153 136 </ItemGroup> 154 137 <ItemGroup> -
trunk/sources/HeuristicLab.Tracing/3.3/HeuristicLabTracingPlugin.cs.frame
r6099 r6173 29 29 [Plugin("HeuristicLab.Tracing", "3.3.4.$WCREV$")] 30 30 [PluginFile("HeuristicLab.Tracing-3.3.dll", PluginFileType.Assembly)] 31 [PluginFile("HeuristicLab.log4net.xml", PluginFileType.Data)]32 [PluginDependency("HeuristicLab.log4net", "1.2.10.0")]33 31 public class HeuristicLabPersistencePlugin : PluginBase {} 34 32 -
trunk/sources/HeuristicLab.Tracing/3.3/Logger.cs
r5445 r6173 20 20 #endregion 21 21 22 22 23 using System; 23 24 using System.Diagnostics; 24 using System.IO;25 using HeuristicLab.Tracing.Properties;26 using log4net;27 using log4net.Config;28 29 25 namespace HeuristicLab.Tracing { 30 26 31 27 /// <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. 34 31 /// </summary> 35 32 public class Logger { 36 33 37 34 /// <summary> 38 /// true if Configure has been called already.35 /// Issues a debug message. 39 36 /// </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(frame.GetMethod().DeclaringType.ToString() + " - " + message.ToString()); 55 41 } 56 42 57 43 /// <summary> 58 /// Gets the default logger for the calling class n levels up in the 59 /// call hierarchy. 44 /// Issues an informational message. 60 45 /// </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(frame.GetMethod().DeclaringType.ToString() + " - " + message.ToString()); 67 50 } 68 51 69 52 /// <summary> 70 /// Gets the default logger: The logger for the class of the 71 /// calling method. 53 /// Issues a warning message. 72 54 /// </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) { 76 57 StackFrame frame = new StackFrame(1); 77 return LogManager.GetLogger(frame.GetMethod().DeclaringType);58 Trace.TraceWarning(frame.GetMethod().DeclaringType.ToString() + " - " + message.ToString()); 78 59 } 79 60 80 61 /// <summary> 81 /// Issues a debug message to the default logger.62 /// Issues an error message. 82 63 /// </summary> 83 64 /// <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(frame.GetMethod().DeclaringType.ToString() + " - " + message.ToString()); 86 68 } 87 69 88 70 /// <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. 122 72 /// </summary> 123 73 /// <param name="type">The type.</param> 124 74 /// <param name="message">The message.</param> 125 75 public static void Debug(Type type, object message) { 126 Configure(); 127 LogManager.GetLogger(type).Debug(message); 76 Trace.TraceInformation(type.ToString() + ": " + message.ToString()); 128 77 } 129 78 130 79 /// <summary> 131 /// Issues an iformational message to the logger of the specified 132 /// type. 80 /// Issues an informational message of the specified type. 133 81 /// </summary> 134 82 /// <param name="type">The type.</param> 135 83 /// <param name="message">The message.</param> 136 84 public static void Info(Type type, object message) { 137 Configure(); 138 LogManager.GetLogger(type).Info(message); 85 Trace.TraceInformation(type.ToString() + ": " + message.ToString()); 139 86 } 140 87 141 88 /// <summary> 142 /// Issues a warning message to the logger of 143 /// the specified type. 89 /// Issues a warning message of the specified type. 144 90 /// </summary> 145 91 /// <param name="type">The type.</param> 146 92 /// <param name="message">The message.</param> 147 93 public static void Warn(Type type, object message) { 148 Configure(); 149 LogManager.GetLogger(type).Warn(message); 94 Trace.TraceWarning(type.ToString() + ": " + message.ToString()); 150 95 } 151 96 152 97 /// <summary> 153 /// Issues an error message to the logger of the specified 154 /// type. 98 /// Issues an error message of the specified type. 155 99 /// </summary> 156 100 /// <param name="type">The type.</param> 157 101 /// <param name="message">The message.</param> 158 102 public static void Error(Type type, object message) { 159 Configure(); 160 LogManager.GetLogger(type).Error(message); 103 Trace.TraceError(type.ToString() + ": " + message.ToString()); 161 104 } 162 105 163 106 /// <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. 177 108 /// </summary> 178 109 /// <param name="message">The message.</param> 179 110 /// <param name="exception">The exception.</param> 180 111 public static void Debug(object message, Exception exception) { 181 GetDefaultLogger(1).Debug(message, exception);112 Trace.TraceInformation(message.ToString() + ": " + exception.ToString()); 182 113 } 183 114 184 115 /// <summary> 185 /// Issues an informational message to the default 186 /// logger including an exception. 116 /// Issues an informational message including an exception. 187 117 /// </summary> 188 118 /// <param name="message">The message.</param> 189 /// <param name="exception">The exception.</param> 190 119 /// <param name="exception">The exception.</param> 191 120 public static void Info(object message, Exception exception) { 192 GetDefaultLogger(1).Info(message, exception);121 Trace.TraceInformation(message.ToString() + ": " + exception.ToString()); 193 122 } 194 123 195 124 /// <summary> 196 /// Issues a warning message to the default 197 /// logger including an exception. 125 /// Issues a warning message including an exception. 198 126 /// </summary> 199 127 /// <param name="message">The message.</param> 200 128 /// <param name="exception">The exception.</param> 201 129 public static void Warn(object message, Exception exception) { 202 GetDefaultLogger(1).Warn(message, exception);130 Trace.TraceWarning(message.ToString() + ": " + exception.ToString()); 203 131 } 204 132 205 133 /// <summary> 206 /// Issues an error message to the default 207 /// logger including an exception. 134 /// Issues an error message including an exception. 208 135 /// </summary> 209 136 /// <param name="message">The message.</param> 210 137 /// <param name="exception">The exception.</param> 211 138 public static void Error(object message, Exception exception) { 212 GetDefaultLogger(1).Error(message, exception);139 Trace.TraceError(message.ToString() + ": " + exception.ToString()); 213 140 } 214 141 215 142 /// <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. 228 144 /// </summary> 229 145 /// <param name="type">The type.</param> … … 231 147 /// <param name="exception">The exception.</param> 232 148 public static void Debug(Type type, object message, Exception exception) { 233 Configure(); 234 LogManager.GetLogger(type).Debug(message, exception); 149 Trace.TraceInformation(type.ToString() + ": " + message.ToString() + ": " + exception.ToString()); 235 150 } 236 151 237 152 /// <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. 240 154 /// </summary> 241 155 /// <param name="type">The type.</param> … … 243 157 /// <param name="exception">The exception.</param> 244 158 public static void Info(Type type, object message, Exception exception) { 245 Configure(); 246 LogManager.GetLogger(type).Info(message, exception); 159 Trace.TraceInformation(type.ToString() + ": " + message.ToString() + ": " + exception.ToString()); 247 160 } 248 161 249 162 /// <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. 252 164 /// </summary> 253 165 /// <param name="type">The type.</param> … … 255 167 /// <param name="exception">The exception.</param> 256 168 public static void Warn(Type type, object message, Exception exception) { 257 Configure(); 258 LogManager.GetLogger(type).Warn(message, exception); 169 Trace.TraceWarning(type.ToString() + ": " + message.ToString() + ": " + exception.ToString()); 259 170 } 260 171 261 172 /// <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. 264 174 /// </summary> 265 175 /// <param name="type">The type.</param> … … 267 177 /// <param name="exception">The exception.</param> 268 178 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(type.ToString() + ": " + message.ToString() + ": " + exception.ToString()); 283 180 } 284 181 } -
trunk/sources/HeuristicLab.Tracing/3.3/Properties/Settings.Designer.cs
r4065 r6173 2 2 // <auto-generated> 3 3 // This code was generated by a tool. 4 // Runtime Version:4.0.30319. 14 // Runtime Version:4.0.30319.225 5 5 // 6 6 // Changes to this file may cause incorrect behavior and will be lost if … … 23 23 } 24 24 } 25 26 [global::System.Configuration.UserScopedSettingAttribute()]27 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]28 [global::System.Configuration.DefaultSettingValueAttribute("")]29 public string TracingLog4netConfigFile {30 get {31 return ((string)(this["TracingLog4netConfigFile"]));32 }33 set {34 this["TracingLog4netConfigFile"] = value;35 }36 }37 25 } 38 26 } -
trunk/sources/HeuristicLab.Tracing/3.3/Properties/Settings.settings
r1622 r6173 3 3 <Profiles /> 4 4 <Settings> 5 <Setting Name="TracingLog4netConfigFile" Type="System.String" Scope="User"> 6 <Value Profile="(Default)" /> 7 </Setting> 5 8 6 </Settings> 9 7 </SettingsFile> -
trunk/sources/HeuristicLab.Tracing/3.3/app.config
r5163 r6173 1 1 <?xml version="1.0"?> 2 <configuration> 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> 3 13 <configSections> 4 14 <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> … … 8 18 <userSettings> 9 19 <HeuristicLab.Tracing.Properties.Settings> 10 <setting name="TracingLog4netConfigFile" serializeAs="String"> 11 <value/> 12 </setting> 20 13 21 </HeuristicLab.Tracing.Properties.Settings> 14 22 </userSettings> -
trunk/tools/ConfigMerger/ConfigMerger.cs
r5163 r6173 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 23 using System.Text; 26 24 using System.Xml; … … 69 67 destinationNode = destination.SelectSingleNode("/configuration/system.serviceModel/services"); 70 68 Merge(sourceNode, destinationNode, destination, "/configuration/system.serviceModel"); 71 69 72 70 #region Merge 'system.serviceModel/bindings/*' 73 71 destinationNode = destination.SelectSingleNode("/configuration/system.serviceModel/bindings"); … … 184 182 destinationNode = destination.SelectSingleNode("/configuration/system.data/DbProviderFactories"); 185 183 Merge(sourceNode, destinationNode, destination, "/configuration"); 184 185 sourceNode = source.SelectSingleNode("/configuration/system.diagnostics"); 186 destinationNode = destination.SelectSingleNode("/configuration/system.diagnostics"); 187 Merge(sourceNode, destinationNode, destination, "/configuration"); 188 189 190 186 191 187 192 destination.Save(destinationFile);
Note: See TracChangeset
for help on using the changeset viewer.