You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by aa...@apache.org on 2023/03/01 15:15:24 UTC
[rocketmq-clients] branch master updated: Make it possible to publish to NuGet
This is an automated email from the ASF dual-hosted git repository.
aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/master by this push:
new 8e985636 Make it possible to publish to NuGet
8e985636 is described below
commit 8e9856366688237ecd008f774fc3ab7cffff118b
Author: Aaron Ai <ya...@gmail.com>
AuthorDate: Wed Mar 1 23:09:10 2023 +0800
Make it possible to publish to NuGet
---
csharp/rocketmq-client-csharp/MqLogManager.cs | 44 +++++++++++++++++++---
.../rocketmq-client-csharp.csproj | 12 ++++--
2 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/csharp/rocketmq-client-csharp/MqLogManager.cs b/csharp/rocketmq-client-csharp/MqLogManager.cs
index 6b117ea5..41ebf5c1 100644
--- a/csharp/rocketmq-client-csharp/MqLogManager.cs
+++ b/csharp/rocketmq-client-csharp/MqLogManager.cs
@@ -16,10 +16,11 @@
*/
using System;
-using System.IO;
-using System.Reflection;
using NLog;
using NLog.Config;
+using NLog.Layouts;
+using NLog.Targets;
+using NLog.Targets.Wrappers;
namespace Org.Apache.Rocketmq
{
@@ -36,12 +37,43 @@ namespace Org.Apache.Rocketmq
private static LogFactory BuildLogFactory()
{
- // Use name of current assembly to construct NLog config filename
- var thisAssembly = Assembly.GetExecutingAssembly();
- var configFilePath = Path.ChangeExtension(thisAssembly.Location, ".nlog");
+ var config = new LoggingConfiguration();
+ var fileTarget = new FileTarget();
+ fileTarget.Name = "log_file";
+ fileTarget.FileName =
+ new SimpleLayout("${specialfolder:folder=UserProfile}/logs/rocketmq/rocketmq-client.log");
+ fileTarget.Layout =
+ new SimpleLayout(
+ "${longdate} ${level:uppercase=true:padding=-5} [${processid}] [${threadid}] [${callsite}:${callsite-linenumber}] ${message} ${onexception:${exception:format=ToString,Data}}");
+ fileTarget.ArchiveFileName =
+ new SimpleLayout("${specialfolder:folder=UserProfile}/logs/rocketmq/rocketmq-client.{######}.log");
+ fileTarget.ArchiveAboveSize = 67108864;
+ fileTarget.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence;
+ fileTarget.MaxArchiveFiles = 10;
+ fileTarget.ConcurrentWrites = true;
+ fileTarget.KeepFileOpen = false;
+
+ var asyncTargetWrapper = new AsyncTargetWrapper(fileTarget);
+ asyncTargetWrapper.Name = "asyncFile";
+ config.AddTarget(asyncTargetWrapper);
+
+ var consoleTarget = new ColoredConsoleTarget();
+ consoleTarget.Name = "colorConsole";
+ consoleTarget.UseDefaultRowHighlightingRules = true;
+ consoleTarget.Layout =
+ new SimpleLayout(
+ "${longdate} ${level:uppercase=true:padding=-5} [${processid}] [${threadid}] [${callsite}:${callsite-linenumber}] ${message} ${onexception:${exception:format=ToString,Data}}");
+
+ config.AddTarget(consoleTarget);
+
+ var asyncFileRule = new LoggingRule("*", LogLevel.FromString("Debug"), asyncTargetWrapper);
+ config.LoggingRules.Add(asyncFileRule);
+
+ var consoleRule = new LoggingRule("*", LogLevel.FromString("Debug"), consoleTarget);
+ config.LoggingRules.Add(consoleRule);
var logFactory = new LogFactory();
- logFactory.Configuration = new XmlLoggingConfiguration(configFilePath, logFactory);
+ logFactory.Configuration = config;
return logFactory;
}
}
diff --git a/csharp/rocketmq-client-csharp/rocketmq-client-csharp.csproj b/csharp/rocketmq-client-csharp/rocketmq-client-csharp.csproj
index 75b600fe..93095c65 100644
--- a/csharp/rocketmq-client-csharp/rocketmq-client-csharp.csproj
+++ b/csharp/rocketmq-client-csharp/rocketmq-client-csharp.csproj
@@ -1,17 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
- <PackageId>RocketMQ-Client-CSharp</PackageId>
- <Version>5.0.1</Version>
+ <PackageId>RocketMQ.Client</PackageId>
+ <Version>0.0.1-SNAPSHOT</Version>
- <Authors>Zhanhui Li</Authors>
+ <Authors>RocketMQ Authors</Authors>
<Company>Apache Software Foundation</Company>
<TargetFramework>net5.0</TargetFramework>
+ <PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<RootNamespace>Org.Apache.Rocketmq</RootNamespace>
+ <PackageReadmeFile>README.md</PackageReadmeFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
+ <Description>.NET Client for Apache RocketMQ</Description>
+ <PackageProjectUrl>https://github.com/apache/rocketmq-clients</PackageProjectUrl>
+ <RepositoryUrl>https://github.com/apache/rocketmq-clients</RepositoryUrl>
</PropertyGroup>
<ItemGroup>
+ <None Include="..\README.md" Pack="true" PackagePath="\"/>
<PackageReference Include="Crc32.NET" Version="1.2.0" />
<PackageReference Include="Google.Protobuf" Version="3.19.4" />
<PackageReference Include="Grpc.Net.Client" Version="2.43.0" />