Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
View
2  src/NHibernate.ZMELogPublisher.Tests/PublisherTests.cs
@@ -29,7 +29,7 @@ public class PublisherTests
private Task subscriberTask;
- private static int numberOfThreads = 100;
+ private static int numberOfThreads = 10;
[TestFixtureSetUp]
public void RunOnceBeforeAllTests()
View
2  src/NHibernate.ZMQLogPublisher/LogDetails.cs
@@ -9,7 +9,5 @@ public class LogDetails
public string Message { get; set; }
public Exception Exception { get; set; }
-
- public string StackTrace { get; set; }
}
}
View
3  src/NHibernate.ZMQLogPublisher/ZmqLogger.cs
@@ -37,8 +37,7 @@ private void Publish(string message, Exception exception)
{
Exception = exception,
Message = message,
- LoggerKey = this.keyName,
- StackTrace = Environment.StackTrace
+ LoggerKey = this.keyName
};
string serializedLogDetails = JsonSerializer.SerializeToString(logDetails);
View
39 src/TestSubscriber/Program.cs
@@ -5,10 +5,21 @@
namespace TestSubscriber
{
+ using System.CodeDom.Compiler;
+ using System.IO;
+
+ using NHibernate.ZMQLogPublisher;
+
+ using ServiceStack.Text;
+
using ZMQ;
class Program
{
+ public static IDictionary<string, List<string>> MessagesPerLogger = new Dictionary<string, List<string>>();
+
+
+
static void Main(string[] args)
{
using(Context context = new Context(1))
@@ -19,11 +30,35 @@ static void Main(string[] args)
string message = "";
- while (true)
+ while (!message.Contains("unbinding factory"))
{
message = subscriber.Recv(Encoding.Unicode);
- Console.WriteLine(message);
+ var logDetails = JsonSerializer.DeserializeFromString<LogDetails>(message);
+
+ if(!MessagesPerLogger.ContainsKey(logDetails.LoggerKey))
+ {
+ MessagesPerLogger.Add(logDetails.LoggerKey, new List<string>());
+ }
+
+ MessagesPerLogger[logDetails.LoggerKey].Add(logDetails.Message);
+ Console.WriteLine(logDetails.Message);
+ }
+
+ IndentedTextWriter writer = new IndentedTextWriter(new StringWriter());
+ foreach (var logger in MessagesPerLogger.Keys)
+ {
+ writer.WriteLine(logger);
+ writer.Indent++;
+ foreach (var logMessage in MessagesPerLogger[logger])
+ {
+ writer.WriteLine(logMessage);
+ }
+
+ writer.Indent--;
+ writer.WriteLine();
}
+
+ File.WriteAllText("loggers.txt", writer.InnerWriter.ToString());
}
}
}
View
9 src/TestSubscriber/TestSubscriber.csproj
@@ -42,6 +42,9 @@
<Reference Include="clrzmq-ext">
<HintPath>..\packages\clrzmq.2.2.2\lib\clrzmq-ext.dll</HintPath>
</Reference>
+ <Reference Include="ServiceStack.Text">
+ <HintPath>..\packages\ServiceStack.Text.3.5.3\lib\net35\ServiceStack.Text.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -62,6 +65,12 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NHibernate.ZMQLogPublisher\NHibernate.ZMQLogPublisher.csproj">
+ <Project>{597BCF5D-5FA2-4BE1-BB2E-42F78C91DE8C}</Project>
+ <Name>NHibernate.ZMQLogPublisher</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
View
1  src/TestSubscriber/packages.config
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="clrzmq" version="2.2.2" />
+ <package id="ServiceStack.Text" version="3.5.3" />
</packages>

No commit comments for this range

Something went wrong with that request. Please try again.