Skip to content

Commit d4083ac

Browse files
committed
re-tested tools.logging and log4j
1 parent 0ea23a6 commit d4083ac

10 files changed

+163
-5
lines changed

tools-logging-log4j/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ Testing whether [clojure/tools.logging](https://github.com/clojure/tools.logging
66

77
Currently testing:
88

9+
tested with GraalVM CE 22.1.0
10+
911
[org.clojure/tools.logging "0.4.1"]
12+
[org.apache.logging.log4j/log4j-core "2.18.0"]
13+
;; also SLF4j works with this configuration
14+
;;[org.slf4j/slf4j-log4j12 "1.7.36"]
15+
16+
1017

1118
Test with:
1219

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[
2+
{
3+
"name":"[Lcom.sun.management.internal.DiagnosticCommandArgumentInfo;"
4+
},
5+
{
6+
"name":"[Lcom.sun.management.internal.DiagnosticCommandInfo;"
7+
},
8+
{
9+
"name":"com.sun.management.internal.DiagnosticCommandArgumentInfo",
10+
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String","boolean","boolean","boolean","int"] }]
11+
},
12+
{
13+
"name":"com.sun.management.internal.DiagnosticCommandInfo",
14+
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","java.lang.String","java.lang.String","java.lang.String","java.lang.String","java.lang.String","boolean","java.util.List"] }]
15+
},
16+
{
17+
"name":"java.lang.Boolean",
18+
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
19+
},
20+
{
21+
"name":"java.lang.ClassLoader",
22+
"methods":[
23+
{"name":"getPlatformClassLoader","parameterTypes":[] },
24+
{"name":"loadClass","parameterTypes":["java.lang.String"] }
25+
]
26+
},
27+
{
28+
"name":"java.lang.String",
29+
"methods":[
30+
{"name":"lastIndexOf","parameterTypes":["int"] },
31+
{"name":"substring","parameterTypes":["int"] }
32+
]
33+
},
34+
{
35+
"name":"java.lang.System",
36+
"methods":[
37+
{"name":"getProperty","parameterTypes":["java.lang.String"] },
38+
{"name":"setProperty","parameterTypes":["java.lang.String","java.lang.String"] }
39+
]
40+
},
41+
{
42+
"name":"java.util.Arrays",
43+
"methods":[{"name":"asList","parameterTypes":["java.lang.Object[]"] }]
44+
},
45+
{
46+
"name":"jdk.internal.loader.ClassLoaders$PlatformClassLoader"
47+
},
48+
{
49+
"name":"org.graalvm.jniutils.JNIExceptionWrapperEntryPoints",
50+
"methods":[{"name":"getClassName","parameterTypes":["java.lang.Class"] }]
51+
},
52+
{
53+
"name":"simple.main",
54+
"methods":[{"name":"main","parameterTypes":["java.lang.String[]"] }]
55+
},
56+
{
57+
"name":"sun.management.VMManagementImpl",
58+
"fields":[
59+
{"name":"compTimeMonitoringSupport"},
60+
{"name":"currentThreadCpuTimeSupport"},
61+
{"name":"objectMonitorUsageSupport"},
62+
{"name":"otherThreadCpuTimeSupport"},
63+
{"name":"remoteDiagnosticCommandsSupport"},
64+
{"name":"synchronizerUsageSupport"},
65+
{"name":"threadAllocatedMemorySupport"},
66+
{"name":"threadContentionMonitoringSupport"}
67+
]
68+
}
69+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"type":"agent-extracted",
4+
"classes":[
5+
]
6+
}
7+
]
8+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[
2+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"name": "clojure.tools.logging.impl.LoggerFactory",
4+
"allPublicConstructors": true,
5+
"allPublicMethods": true
6+
},
7+
{
8+
"name": "org.apache.log4j.AppenderSkeleton",
9+
"allPublicConstructors": true,
10+
"allPublicMethods": true
11+
},
12+
{
13+
"name": "org.apache.log4j.ConsoleAppender",
14+
"allPublicConstructors": true,
15+
"allPublicMethods": true
16+
},
17+
{
18+
"name": "org.apache.log4j.Layout",
19+
"allPublicConstructors": true,
20+
"allPublicMethods": true
21+
},
22+
{
23+
"name": "org.apache.log4j.PatternLayout",
24+
"allPublicConstructors": true,
25+
"allPublicMethods": true
26+
},
27+
{
28+
"name": "org.apache.log4j.WriterAppender",
29+
"allPublicConstructors": true,
30+
"allPublicMethods": true
31+
},
32+
{
33+
"name": "org.slf4j.Logger",
34+
"allPublicConstructors": true,
35+
"allPublicMethods": true
36+
},
37+
{
38+
"name": "org.slf4j.LoggerFactory",
39+
"allPublicConstructors": true,
40+
"allPublicMethods": true
41+
}
42+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"resources": {
3+
"includes": [
4+
{
5+
"pattern": "\\Qlog4j.properties\\E"
6+
}
7+
]
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"types":[
3+
],
4+
"lambdaCapturingTypes":[
5+
]
6+
}

tools-logging-log4j/project.clj

+16-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
:dependencies [[org.clojure/clojure "1.10.0"]
44
[org.clojure/tools.logging "0.4.1"]
5-
[log4j/log4j "1.2.17"]]
5+
;; also SLF4j works with this configuration
6+
;;[org.slf4j/slf4j-log4j12 "1.7.36"]
7+
[org.apache.logging.log4j/log4j-core "2.18.0"]
8+
[com.github.clj-easy/graal-build-time "0.1.4"]]
69

710
:main simple.main
811

@@ -11,10 +14,19 @@
1114
:dev {:plugins [[lein-shell "0.5.0"]]}}
1215

1316
:aliases
14-
{"native"
17+
{
18+
"native-config"
1519
["shell"
16-
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
17-
"--initialize-at-build-time"
20+
"java" "-agentlib:native-image-agent=config-merge-dir=./graalvm-config"
21+
"-jar" "target/simple-main.jar"]
22+
23+
24+
"native"
25+
["shell"
26+
"native-image" "--report-unsupported-elements-at-runtime"
27+
"--no-fallback" "--allow-incomplete-classpath"
28+
"-H:Log=registerResource:"
29+
"-H:ConfigurationFileDirectories=./graalvm-config/"
1830
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
1931
"-H:Name=./target/${:name}"]
2032

tools-logging-log4j/resources/log4j.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ log4j.appender.stdout.layout.ConversionPattern=%-5p %c{1}:%L - %m%n
1111
# Print only messages of level DEBUG or above in the package
1212
# log4j.logger.com.mypackage=DEBUG, stdout
1313
# or
14-
# log4j.category.com.mypackage=DEBUG
14+
log4j.category.simple.main=DEBUG

tools-logging-log4j/src/simple/main.clj

+3
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66

77
(defn -main []
88
(log/info "Hello GraalVM")
9+
(log/debug "This is a debug message!")
10+
;; uncomment this to test SLF4j as well
11+
;;(.info (org.slf4j.LoggerFactory/getLogger String) "This is from SLF4j")
912
(println "done!"))

0 commit comments

Comments
 (0)