IKVM.Extensions.Logging.Java.Util
1.0.1
Prefix Reserved
dotnet add package IKVM.Extensions.Logging.Java.Util --version 1.0.1
NuGet\Install-Package IKVM.Extensions.Logging.Java.Util -Version 1.0.1
<PackageReference Include="IKVM.Extensions.Logging.Java.Util" Version="1.0.1" />
<PackageVersion Include="IKVM.Extensions.Logging.Java.Util" Version="1.0.1" />
<PackageReference Include="IKVM.Extensions.Logging.Java.Util" />
paket add IKVM.Extensions.Logging.Java.Util --version 1.0.1
#r "nuget: IKVM.Extensions.Logging.Java.Util, 1.0.1"
#:package IKVM.Extensions.Logging.Java.Util@1.0.1
#addin nuget:?package=IKVM.Extensions.Logging.Java.Util&version=1.0.1
#tool nuget:?package=IKVM.Extensions.Logging.Java.Util&version=1.0.1
IKVM.Extensions.Logging.Java.Util
A java.util.logging.Handler that forwards the records raised by Java code running under
IKVM to Microsoft.Extensions.Logging, so a Java library logs through the
same pipeline as the rest of the application instead of writing to its own console handler.
Supported platforms
Targets .NET 8, and is verified on .NET 8 and .NET 10.
Install
dotnet add package IKVM.Extensions.Logging.Java.Util
Use
Attach a handler to the logger whose subtree should be forwarded, which is usually the root:
using IKVM.Extensions.Logging.Java.Util;
using java.util.logging;
var root = LogManager.getLogManager().getLogger("");
// otherwise every record is also written to the console by java.util.logging's own default handler
foreach (var handler in root.getHandlers())
root.removeHandler(handler);
root.addHandler(new LoggerHandler(loggerFactory));
root.setLevel(Level.ALL);
A record reaches the handler under the name of the Java logger that raised it, so the category an
ILogger is created with is the Java logger name — org.apache.calcite.plan.hep.HepPlanner, for example —
and the usual Logging:LogLevel configuration filters on it by prefix.
Levels
Levels are mapped by value, so a custom level sits wherever its severity puts it:
| java.util.logging | LogLevel |
|---|---|
SEVERE and above |
Error |
WARNING |
Warning |
INFO, CONFIG |
Information |
FINE |
Debug |
FINER, FINEST |
Trace |
OFF |
dropped |
A Java logger filters on its own level before any handler is reached. A subtree left at its default
INFO forwards nothing finer no matter how permissive the ILoggerFactory is, which is why the example
above sets Level.ALL on the root: set the Java side to the finest level any ILogger rule asks for, and
let Microsoft.Extensions.Logging do the filtering from there.
Notes
flush()does nothing. Records are handed over as they arrive, and any buffering past that point belongs to the logging provider.close()stops forwarding but leaves theILoggerFactoryopen — it belongs to the caller.- A failure inside the logging pipeline goes to the handler's
ErrorManagerrather than propagating into the Java code that raised the record.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- IKVM (>= 8.16.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
-
net8.0
- IKVM (>= 8.16.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.