Skip to content

Commit f07a165

Browse files
committed
added logging library
1 parent 01ada39 commit f07a165

File tree

12 files changed

+127
-1
lines changed

12 files changed

+127
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Here the instructions on how to build your own Clojure projects with GraalVM.
1212
Here the list of libraries tested:
1313

1414
- [Clojure core](./clojure) :white_check_mark:
15+
- [clojure/tools.logging](./tools-logging) - Logging library :white_check_mark:
16+
- [clojure/tools.logging+log4j](./tools-logging-log4j) - Logging library :white_check_mark:
1517
- [amazonica+s3](./amazonica-s3) - Cloud API wrapper library :x: (*Buildtime and Runtime error*)
1618
- [cheshire](./cheshire) - JSON parser/writer :white_check_mark:
1719
- [nippy](./nippy) - Clojure serialization/deserialization library :warning: (*Can't serialize exceptions*)

ring-jetty/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject cheshire "0.1.0-SNAPSHOT"
1+
(defproject ring-jetty "0.1.0-SNAPSHOT"
22
:description "FIXME: write description"
33
:url "http://example.com/FIXME"
44
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"

safely/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# safely
22

33
Testing whether [Safely](https://github.com/BrunoBonacci/safely) library can be used in a native binary image with GraalVM.
4+
It also show how to deal with SLF4J and Log4j.
45

56
## Usage
67

tools-logging-log4j/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/target
2+
/classes
3+
/checkouts
4+
profiles.clj
5+
pom.xml
6+
pom.xml.asc
7+
*.jar
8+
*.class
9+
/.lein-*
10+
/.nrepl-port
11+
.hgignore
12+
.hg/

tools-logging-log4j/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# clojure/tools.logging
2+
3+
Testing whether [clojure/tools.logging](https://github.com/clojure/tools.logging) library can be used in a native binary image with GraalVM.
4+
5+
## Usage
6+
7+
Currently testing:
8+
9+
[org.clojure/tools.logging "0.4.1"]
10+
11+
Test with:
12+
13+
lein do clean, uberjar, native, run-native

tools-logging-log4j/project.clj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(defproject tools-logging "0.1.0-SNAPSHOT"
2+
3+
:dependencies [[org.clojure/clojure "1.10.0"]
4+
[org.clojure/tools.logging "0.4.1"]
5+
[log4j/log4j "1.2.17"]]
6+
7+
:main simple.main
8+
9+
:uberjar-name "simple-main.jar"
10+
:profiles {:uberjar {:aot :all}
11+
:dev {:plugins [[lein-shell "0.5.0"]]}}
12+
13+
:aliases
14+
{"native"
15+
["shell"
16+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
17+
"--initialize-at-build-time"
18+
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
19+
"-H:Name=./target/${:name}"]
20+
21+
"run-native" ["shell" "./target/${:name}"]})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Root logger option
2+
log4j.rootLogger=INFO, stdout
3+
4+
# Direct log messages to stdout
5+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
6+
log4j.appender.stdout.Target=System.out
7+
log4j.appender.stdout.encoding=UTF-8
8+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
9+
log4j.appender.stdout.layout.ConversionPattern=%-5p %c{1}:%L - %m%n
10+
11+
# Print only messages of level DEBUG or above in the package
12+
# log4j.logger.com.mypackage=DEBUG, stdout
13+
# or
14+
# log4j.category.com.mypackage=DEBUG
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns simple.main
2+
(:require [clojure.tools.logging :as log])
3+
(:gen-class))
4+
5+
6+
7+
(defn -main []
8+
(log/info "Hello GraalVM")
9+
(println "done!"))

tools-logging/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/target
2+
/classes
3+
/checkouts
4+
profiles.clj
5+
pom.xml
6+
pom.xml.asc
7+
*.jar
8+
*.class
9+
/.lein-*
10+
/.nrepl-port
11+
.hgignore
12+
.hg/

tools-logging/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# clojure/tools.logging
2+
3+
Testing whether [clojure/tools.logging](https://github.com/clojure/tools.logging) library can be used in a native binary image with GraalVM.
4+
5+
## Usage
6+
7+
Currently testing:
8+
9+
[org.clojure/tools.logging "0.4.1"]
10+
11+
Test with:
12+
13+
lein do clean, uberjar, native, run-native

tools-logging/project.clj

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(defproject tools-logging "0.1.0-SNAPSHOT"
2+
3+
:dependencies [[org.clojure/clojure "1.10.0"]
4+
[org.clojure/tools.logging "0.4.1"]]
5+
6+
:main simple.main
7+
8+
:uberjar-name "simple-main.jar"
9+
:profiles {:uberjar {:aot :all}
10+
:dev {:plugins [[lein-shell "0.5.0"]]}}
11+
12+
:aliases
13+
{"native"
14+
["shell"
15+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
16+
"--initialize-at-build-time"
17+
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
18+
"-H:Name=./target/${:name}"]
19+
20+
"run-native" ["shell" "./target/${:name}"]})

tools-logging/src/simple/main.clj

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(ns simple.main
2+
(:require [clojure.tools.logging :as log])
3+
(:gen-class))
4+
5+
6+
7+
(defn -main []
8+
(log/info "Hello GraalVM")
9+
(println "done!"))

0 commit comments

Comments
 (0)