-
Notifications
You must be signed in to change notification settings - Fork 483
Castle.Services.Logging.EventLogIntegration for Windows EventLog #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
90fc013 to
e2d3359
Compare
e4f9c96 to
bf66485
Compare
a05e9c2 to
a891322
Compare
|
@snakefoot, it's been a while. I've finally found a moment to look at this. Sorry for letting you wait so long. Code conflicts resulting from the merge of #696 aside, I think we should first come to a decision on the future of Castle's logging facilities in general (see #408) before we proceed here. As long as we haven't decided for or against deprecating the logging facilities as a whole, I'd prefer not to invest too much time in them... including this PR. I do agree that it's a bit strange to have almost all bits of a library work on all platforms except this one class, Given these considerations, perhaps it would be much less trouble simply changing |
674a756 to
f61e440
Compare
|
Still think Castle.Core should have minimal dependencies, and not drag unnecessary dependencies for all users. Also considering that the Castle.Core-Logging-API is not that relevant after the introduction of Microsoft.Extensions.Logging. The |
|
@snakefoot, you're making a good argument regarding minimal dependencies, I definitely agree with you there. (If it were solely up to me, I'd go much further and reduce Castle.Core to just DynamicProxy. But this project traditionally tries very hard not to cause unnecessary breaking changes for downstream users, which I think is a good policy for any infrastructure library. So I'm practicing some restraint there. 🙃) Maybe introducing an additional logging package really wouldn't be a big deal, even if it ends up being a short-lived intermediate step towards abandoning the logging facilities. (Especially when considering that coming to a conclusion in #408 may be indefinitely held up by the Castle Windsor project, which hasn't seen any active development in a while.) Let me sleep on this. |
stakx
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's entirely possible that the logging facilities will soon disappear completely, but in case that we keep them around, I now agree with you that the Castle.Core package should be freed from the package dependency on System.Diagnostics.EventLog.
Could you please rebase your PR on top of current master and look into the few things I've commented on? You may additionally have to update the ref/ files, too.
|
|
||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| # Visual Studio Version 16 | ||
| VisualStudioVersion = 16.0.30011.22 | ||
| # Visual Studio Version 17 | ||
| VisualStudioVersion = 17.11.35312.102 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've since converted the solution file to the simpler .slnx format, please edit Castle.Core.slnx instead.
| <SignAssembly>False</SignAssembly> | ||
| <PublicSign Condition="'$(OS)'=='Unix'">false</PublicSign> | ||
| <StartupObject>Program</StartupObject> | ||
| <InvariantGlobalization>true</InvariantGlobalization> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change strictly required for offloading DiagnosticsLogger into a separate project/package? If not (which I suspect), please undo this change.
Same goes for the same change in Castle.Core.Tests.csproj.
| </ItemGroup> | ||
|
|
||
| <ItemGroup Condition="'$(TargetFramework)'=='net8.0'"> | ||
| <PackageReference Include="System.Diagnostics.EventLog" Version="8.0.2" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new Castle.Services.Logging.EventLogIntegration.csproj file, you're using a different condition:
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' != '.NETFramework' ">
<PackageReference Include="System.Diagnostics.EventLog" Version="8.0.2" />
</ItemGroup>Should we perhaps do it the same way here, too?
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the year in the first line of the copyright notice from 2004-2022 to 2004-2025 (or 2026, depending on when you get around to touching that file again).
Same goes for the other code files that you're adding/changing.
| <GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
| <PackageOutputPath>../../build/</PackageOutputPath> | ||
| <AssemblyName>Castle.Services.Logging.EventLogIntegration</AssemblyName> | ||
| <RootNamespace>Castle.Services.Logging</RootNamespace> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make sense to stay in line with the other Castle.Services.Logging.XYIntegration projects and choose a root namespace that is identical to the assembly name, so <RootNamespace>Castle.Services.Logging.EventLogIntegration</RootNamespace> in this case.
| <ItemGroup> | ||
| <Folder Include="Properties\" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unnecessary, this project does not have a Properties/ sub-directory.
| @@ -1,4 +1,4 @@ | |||
| // Copyright 2004-2022 Castle Project - http://www.castleproject.org/ | |||
| // Copyright 2004-2022 Castle Project - http://www.castleproject.org/ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, please update the year from 2004-2022 to either 2004-2025 or 2004-2026 (depending on when you get around to doing so).
| // limitations under the License. | ||
|
|
||
| namespace Castle.Core.Logging | ||
| namespace Castle.Services.Logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, I think it would be better to either...:
- use namespace
Castle.Services.Logging.EventLogIntegration(for consistency with other logging integration packages); or - or otherwise to preserve the original namespace (for minimal breakage).
IMHO option (1) would be the better one, since DiagnosticsLogger no longer lives in the "core" package, so perhaps the namespace should reflect that.
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="NLog" Version="4.5.0" /> | ||
| <PackageReference Include="NLog" Version="4.7.15" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an unrelated change; please revert it.
Removed nuget-dependency
System.Diagnostics.EventLogfrom the Castle.Core-package as it is Windows-only (And will explode in your face when used on other platforms).Makes Castle.Core free of extra nuget-dependencies for
net462+netstandard2.1+net8.0(essence of core)People using Windows and depend on the
DiagnosticsLoggerjust have to add an additional nuget-package to their project.Could consider changing
net8.0tonet8.0-windowsforCastle.Services.Logging.EventlogIntegrationand remove the direct nuget-dependency.