mirror of https://github.com/qos-ch/slf4j
Compare commits
655 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
61400453cd | |
|
|
58b66c2c7e | |
|
|
be4841cce8 | |
|
|
d2073bece8 | |
|
|
32a9854cf4 | |
|
|
77936c6f1f | |
|
|
34c9d30af5 | |
|
|
902b463957 | |
|
|
b3c2f16f12 | |
|
|
9468c7a28f | |
|
|
183aaa5070 | |
|
|
c233ea1932 | |
|
|
4b4d533771 | |
|
|
9349d64f95 | |
|
|
0def25ebfa | |
|
|
69c333de28 | |
|
|
2470fad4fd | |
|
|
c2c29fec98 | |
|
|
0597225b5b | |
|
|
f7b34c2e60 | |
|
|
4fa92fc007 | |
|
|
101086ba35 | |
|
|
8ae0efca23 | |
|
|
3ff00870b3 | |
|
|
0df43e9e53 | |
|
|
46b5ea54a6 | |
|
|
5321a975d4 | |
|
|
09111e8c1e | |
|
|
6a04f67fdd | |
|
|
03aa6b915a | |
|
|
7c3b0ef011 | |
|
|
42810107b0 | |
|
|
982e4b067f | |
|
|
dd4486b5c5 | |
|
|
1d82519b07 | |
|
|
5ffbc67def | |
|
|
3386517ad6 | |
|
|
448bca173c | |
|
|
955209464d | |
|
|
c1473c957a | |
|
|
98932348fb | |
|
|
c52da92599 | |
|
|
da91e4f219 | |
|
|
8c4ea8f225 | |
|
|
6b2921a523 | |
|
|
3f4717c44e | |
|
|
d9145fba56 | |
|
|
68ff7064ec | |
|
|
db8cd90c10 | |
|
|
d564304a61 | |
|
|
ef8dda71dd | |
|
|
fe42ecb5f7 | |
|
|
7029a8b7fd | |
|
|
8c873b2e75 | |
|
|
7bcee9aa1f | |
|
|
6fe9c07113 | |
|
|
df562c22d8 | |
|
|
6d39ca8bf9 | |
|
|
86ee8298d9 | |
|
|
5ccbe20b11 | |
|
|
02b36a269a | |
|
|
c12667b906 | |
|
|
316b5d1727 | |
|
|
7c164fab8d | |
|
|
56e42fdb61 | |
|
|
216459e5d8 | |
|
|
2481810f94 | |
|
|
25d742d666 | |
|
|
10a151756d | |
|
|
17f5bf3d87 | |
|
|
f967033766 | |
|
|
0b9c92cc3a | |
|
|
05698f8d23 | |
|
|
9783320b6c | |
|
|
aa13da39ed | |
|
|
7a4da876b3 | |
|
|
0769bc8182 | |
|
|
e63f87f02c | |
|
|
3f20e0dfd2 | |
|
|
06fa09a2fb | |
|
|
6fd9db9b5e | |
|
|
f871e7f2e9 | |
|
|
0b4d88edef | |
|
|
2ec7c1034c | |
|
|
df44ace9c3 | |
|
|
661869eeb2 | |
|
|
cff3312e43 | |
|
|
d6a21ae68f | |
|
|
13950e51a6 | |
|
|
122e0c18dd | |
|
|
2a8ca99caf | |
|
|
b363bb31ed | |
|
|
2235d3c698 | |
|
|
a5540ad510 | |
|
|
1ed084cbc0 | |
|
|
b2cb017422 | |
|
|
fa6721a53e | |
|
|
f85104040c | |
|
|
5ff6f2c385 | |
|
|
2f4aa75445 | |
|
|
363f0a534e | |
|
|
171679baa8 | |
|
|
921b5b31e1 | |
|
|
e02244c39f | |
|
|
441d4584be | |
|
|
f5e741ba1a | |
|
|
2e71327c8e | |
|
|
3ff2a30e05 | |
|
|
7e62e1e691 | |
|
|
d250ad79eb | |
|
|
3bc58f3e81 | |
|
|
207bb299c3 | |
|
|
35dd7ff1e7 | |
|
|
440c2f3000 | |
|
|
43a36303e5 | |
|
|
557bf7c0bd | |
|
|
632410565b | |
|
|
e540299d58 | |
|
|
dfb41b06a8 | |
|
|
47c7cc7fa4 | |
|
|
0be1bc15f2 | |
|
|
d60690c0b9 | |
|
|
6720d8db66 | |
|
|
72a0bc6528 | |
|
|
f276d52d96 | |
|
|
7cad6082dc | |
|
|
143978ce05 | |
|
|
88b0ee3c1f | |
|
|
b2cb05f16a | |
|
|
4b5bb41ede | |
|
|
b500a6fdfd | |
|
|
d81affb012 | |
|
|
bcbbe40ffd | |
|
|
7686020c36 | |
|
|
3f47f87ccc | |
|
|
eb1710af7b | |
|
|
bb49a5aeef | |
|
|
768ca7d4c0 | |
|
|
0645c18caf | |
|
|
894b1890a0 | |
|
|
7c1d86e21e | |
|
|
9752442b6e | |
|
|
c0f7f16bfb | |
|
|
1148b98529 | |
|
|
593f89f85a | |
|
|
03deea9f77 | |
|
|
c9d5cc1257 | |
|
|
bae56f544b | |
|
|
24788ac731 | |
|
|
05c0b0a881 | |
|
|
400a885e7d | |
|
|
a4f165689f | |
|
|
4685f1ebc0 | |
|
|
15d4c1fdd6 | |
|
|
42f863863f | |
|
|
51ceaf6224 | |
|
|
0614d467d7 | |
|
|
b1afcd01b1 | |
|
|
20cd3ad0ab | |
|
|
aeebb6199d | |
|
|
1068cd0eb9 | |
|
|
4e4e56a2df | |
|
|
0dcfa19040 | |
|
|
e7ca8d17c8 | |
|
|
2314de9dd9 | |
|
|
508a796552 | |
|
|
d93a5e0456 | |
|
|
43005d1d85 | |
|
|
14ec670971 | |
|
|
c0001d4619 | |
|
|
9feda2c795 | |
|
|
287fe4f97a | |
|
|
5537ff1699 | |
|
|
996866fae7 | |
|
|
ae032b1297 | |
|
|
6afe5ab7a7 | |
|
|
82a592ed79 | |
|
|
e454d28282 | |
|
|
db3835d392 | |
|
|
61574d22f4 | |
|
|
9dd3de0511 | |
|
|
6701960a59 | |
|
|
98728180ac | |
|
|
ac854c79ea | |
|
|
0c0eb1275d | |
|
|
2b0e15874a | |
|
|
045f502fa9 | |
|
|
a188a3ed73 | |
|
|
23182d4468 | |
|
|
aa0de34dc6 | |
|
|
5c4fe1d48c | |
|
|
90f3f1ea07 | |
|
|
5fcbb283a3 | |
|
|
956acb06d6 | |
|
|
6df6053c24 | |
|
|
74ccf20fab | |
|
|
8806a45ede | |
|
|
2287768293 | |
|
|
bef80280e6 | |
|
|
c1282ba08c | |
|
|
81a0568d68 | |
|
|
f04cf16b66 | |
|
|
c69570fc51 | |
|
|
85541d5669 | |
|
|
4835381767 | |
|
|
c9c5492ded | |
|
|
510cc99e37 | |
|
|
a20a22299d | |
|
|
2d6b6344f0 | |
|
|
16ab482cab | |
|
|
39a07b9ce4 | |
|
|
10bd70ca75 | |
|
|
66e9c2555f | |
|
|
28528094b9 | |
|
|
6abaf6897b | |
|
|
39cf0fc837 | |
|
|
0e04efdbf6 | |
|
|
0d4167abe7 | |
|
|
60e70fbc83 | |
|
|
9e4a358634 | |
|
|
f6076c1409 | |
|
|
34547b2f32 | |
|
|
ea47492d7a | |
|
|
f09e33dd15 | |
|
|
12b5a6b676 | |
|
|
23c8cc0121 | |
|
|
0877cb6410 | |
|
|
7144b50915 | |
|
|
0e8713e1eb | |
|
|
62a265d3c5 | |
|
|
59100d75e1 | |
|
|
b655c0a2b7 | |
|
|
6208cbbded | |
|
|
7c62cf8254 | |
|
|
c61f01783a | |
|
|
ce15e71dd8 | |
|
|
c6ea154309 | |
|
|
2a9bcb15e0 | |
|
|
53a9833a3c | |
|
|
71d5c081e8 | |
|
|
81d57c271b | |
|
|
65524de79a | |
|
|
45fbb1ebc8 | |
|
|
7a68675fc6 | |
|
|
25ddfaaab0 | |
|
|
98f1f2f465 | |
|
|
cf09b2e34d | |
|
|
1cea7b72e3 | |
|
|
50a68fe8cc | |
|
|
6f0c54caa4 | |
|
|
590434e55f | |
|
|
545755c2b7 | |
|
|
0a34a87495 | |
|
|
252593b934 | |
|
|
43bcc961a2 | |
|
|
f8bb0da47b | |
|
|
1d4535ad23 | |
|
|
baadb61681 | |
|
|
41b612d150 | |
|
|
6e784e4ca3 | |
|
|
b977791f50 | |
|
|
4672a6fd52 | |
|
|
d0836be06f | |
|
|
c7d79d86a9 | |
|
|
9bc0152371 | |
|
|
21af69f3eb | |
|
|
55357d2270 | |
|
|
66aed4dfb1 | |
|
|
ccbd8f8c96 | |
|
|
7836be3be5 | |
|
|
c2e02170bb | |
|
|
e240abe9b1 | |
|
|
eaa9fae39d | |
|
|
a42ad1f4f7 | |
|
|
e0448ad699 | |
|
|
cc8e690ee8 | |
|
|
4083b3dd0f | |
|
|
1754a89208 | |
|
|
d6c2ddbe89 | |
|
|
551283ba4c | |
|
|
c0bacabab2 | |
|
|
2d3e9f7d2b | |
|
|
e6d5d12c03 | |
|
|
5958599ca9 | |
|
|
66dda1a323 | |
|
|
280129046e | |
|
|
cf4d011ac0 | |
|
|
8d5df5a41c | |
|
|
fc66b1fc68 | |
|
|
316e59084d | |
|
|
7483a11dd6 | |
|
|
47e751d63c | |
|
|
fb1929011f | |
|
|
5b3e70a353 | |
|
|
19d037f11a | |
|
|
75f6c0b2f9 | |
|
|
5a0eba57e5 | |
|
|
3321b220b8 | |
|
|
b682787a2e | |
|
|
252fbffede | |
|
|
8601beed76 | |
|
|
8571f5d7f2 | |
|
|
62d6497f6a | |
|
|
b5446d67bb | |
|
|
8f602c309a | |
|
|
04f3d418d1 | |
|
|
8859a8a019 | |
|
|
0ae15e3981 | |
|
|
c233c86457 | |
|
|
e74699276b | |
|
|
65eacb35a8 | |
|
|
3e0016d8d1 | |
|
|
601405b76f | |
|
|
10d78b04d6 | |
|
|
7547d1c871 | |
|
|
45b177c2d2 | |
|
|
730ee35665 | |
|
|
3afcb8e8c4 | |
|
|
8a83b1bd34 | |
|
|
4cd41f799d | |
|
|
9558b2103e | |
|
|
a1683d9323 | |
|
|
da6b46d8d7 | |
|
|
092d527971 | |
|
|
153a6cabda | |
|
|
494bd9aee9 | |
|
|
1600611850 | |
|
|
b56a878bc2 | |
|
|
865c88e340 | |
|
|
91eb61c3c9 | |
|
|
63ac275a5f | |
|
|
ccce832b8f | |
|
|
b38727956d | |
|
|
0b1d536e04 | |
|
|
6359e55d52 | |
|
|
4c1b6832f6 | |
|
|
a9d4187fad | |
|
|
03c37619d5 | |
|
|
6a09a76bb6 | |
|
|
4a11208ae4 | |
|
|
65009d8e62 | |
|
|
2f1ccdddae | |
|
|
a739d541a5 | |
|
|
76cc29cb47 | |
|
|
230573ab10 | |
|
|
b0e3ad34f4 | |
|
|
a0319ce725 | |
|
|
78b1f19a64 | |
|
|
2d3c03622e | |
|
|
6719babbce | |
|
|
17528421bf | |
|
|
6ec50c7b47 | |
|
|
ce640dbce2 | |
|
|
fbadf47724 | |
|
|
d779d080e4 | |
|
|
ec75e2b0f3 | |
|
|
d03c5fe016 | |
|
|
9213667ba2 | |
|
|
8ee427d6bb | |
|
|
ed1ffb325a | |
|
|
fdf496daf2 | |
|
|
7fbe973ad9 | |
|
|
13736433b1 | |
|
|
c81f6cfdbd | |
|
|
7202302537 | |
|
|
6eaeb0f6af | |
|
|
a9f84d58b3 | |
|
|
c1c8d21bc4 | |
|
|
854d6fbf79 | |
|
|
a35c1d331d | |
|
|
ea8da7fedd | |
|
|
7e6e3d1f24 | |
|
|
176e067fb9 | |
|
|
1238dbcb0b | |
|
|
1df318d08a | |
|
|
315a95824b | |
|
|
21c1be85ab | |
|
|
7af8f7e2f4 | |
|
|
50eec4afd6 | |
|
|
1cd31dc9bb | |
|
|
3a06ff0b19 | |
|
|
f9b0656ad8 | |
|
|
01340b2bcf | |
|
|
9ce38e487b | |
|
|
a73b744853 | |
|
|
cebdf810d6 | |
|
|
21be0bccef | |
|
|
df48717c87 | |
|
|
334ef9a266 | |
|
|
a0030b6e6a | |
|
|
e108a279c7 | |
|
|
5f45225565 | |
|
|
efeb3665c1 | |
|
|
456e8a8841 | |
|
|
383f008a05 | |
|
|
6f1583fb01 | |
|
|
69338e78f3 | |
|
|
f0674e9648 | |
|
|
3c4b29b061 | |
|
|
fa20cc51be | |
|
|
258caf4a61 | |
|
|
b67dabb03d | |
|
|
e2f0fca4ad | |
|
|
1d4daa1c53 | |
|
|
8c2ee1378e | |
|
|
877817a5a3 | |
|
|
8eea071d3e | |
|
|
11d5b0bd8d | |
|
|
caa81d7368 | |
|
|
2dc0cd2b32 | |
|
|
ba8506c47b | |
|
|
947654aa64 | |
|
|
9df53fb968 | |
|
|
c87ac7bb29 | |
|
|
a1c763e6e1 | |
|
|
5f6f92a8d1 | |
|
|
bb1ca6886a | |
|
|
975a9a1e7e | |
|
|
3e2381ea69 | |
|
|
edb09d7ffa | |
|
|
f91024f676 | |
|
|
28e07908a2 | |
|
|
6a61c433ee | |
|
|
50e1c635d5 | |
|
|
36e39dd0cf | |
|
|
666533989a | |
|
|
39e3b81e5e | |
|
|
3f4d3d91f3 | |
|
|
81b95ab868 | |
|
|
2c914492fd | |
|
|
ff4a3a438e | |
|
|
15e1e7704b | |
|
|
6a06d84243 | |
|
|
a9caf3ee3c | |
|
|
280335bf14 | |
|
|
f9c4dcd1dd | |
|
|
dd2bb115b0 | |
|
|
d7786eafa7 | |
|
|
684dfca280 | |
|
|
05486b909a | |
|
|
86e45d7728 | |
|
|
b4b2f6fef7 | |
|
|
49831a3f06 | |
|
|
49356a792a | |
|
|
3d01cc2ca3 | |
|
|
61220a8b42 | |
|
|
be3007c6cd | |
|
|
9e9a64bcb6 | |
|
|
854ce8aa7d | |
|
|
7b753d69b0 | |
|
|
5c586f1192 | |
|
|
17e73cee3a | |
|
|
990b508703 | |
|
|
cb4ac02d7b | |
|
|
92d20a66be | |
|
|
6f23d94201 | |
|
|
ba62fdc694 | |
|
|
0ef8cb4721 | |
|
|
d0dad8aa38 | |
|
|
5c0f12afae | |
|
|
5fb5ecb98a | |
|
|
a405c8db97 | |
|
|
82aca890f0 | |
|
|
ade6380f1a | |
|
|
44371046e0 | |
|
|
3c927fa7ed | |
|
|
2d1d948c5e | |
|
|
c34960912a | |
|
|
3e5110501c | |
|
|
57a06aaa2c | |
|
|
61e879fa32 | |
|
|
d8b223e379 | |
|
|
e2c29c81df | |
|
|
76ee1112e5 | |
|
|
715b591185 | |
|
|
2ac2e807ea | |
|
|
306d8fd23d | |
|
|
27358d395c | |
|
|
9a3f1f4928 | |
|
|
4a1d5194fe | |
|
|
7c56fe22eb | |
|
|
043e9f2d6d | |
|
|
e00d9a145b | |
|
|
11bc6c56e3 | |
|
|
fd5c84fabc | |
|
|
1f49dffdf3 | |
|
|
78a2bf7352 | |
|
|
a04a1f31cf | |
|
|
340b820478 | |
|
|
33dc750730 | |
|
|
8756e69497 | |
|
|
233803688a | |
|
|
0c1d72b602 | |
|
|
a4010572cb | |
|
|
b726801a9b | |
|
|
80b7d224e8 | |
|
|
0ae60630b5 | |
|
|
112271b8f6 | |
|
|
93e9f097a1 | |
|
|
6f217bbf63 | |
|
|
0d0f187b14 | |
|
|
c025afe536 | |
|
|
32532107f5 | |
|
|
e757c41a57 | |
|
|
78c10ee651 | |
|
|
178e836f71 | |
|
|
4ed24489fa | |
|
|
8a5c449bd8 | |
|
|
b266bb2937 | |
|
|
b0b57b9f9b | |
|
|
a98bd22216 | |
|
|
587ec03af7 | |
|
|
7c3d35596f | |
|
|
9df5d4fe91 | |
|
|
a09d788310 | |
|
|
b99ad9f80f | |
|
|
fe440ce9cd | |
|
|
206449b674 | |
|
|
173b06ad88 | |
|
|
999539196e | |
|
|
9439356727 | |
|
|
96783aab43 | |
|
|
e0a6d06fc0 | |
|
|
acc915075b | |
|
|
d5074263f8 | |
|
|
b05e7fe90d | |
|
|
a5eb9ce00c | |
|
|
fde8ca480c | |
|
|
7533fde765 | |
|
|
83b88c502a | |
|
|
a5357c8d49 | |
|
|
f9c1d25113 | |
|
|
4faf891b8a | |
|
|
890fc5b0e6 | |
|
|
d3f50a9185 | |
|
|
365edc7c32 | |
|
|
669c550ab8 | |
|
|
68c7c99adf | |
|
|
c243bc6476 | |
|
|
abad55509a | |
|
|
e52fb5ae15 | |
|
|
d9690a131e | |
|
|
029eab1569 | |
|
|
4d4ebb395e | |
|
|
c7b2218283 | |
|
|
1f3b8726d1 | |
|
|
8c51d8ea7c | |
|
|
8705978bb7 | |
|
|
1cb6b26288 | |
|
|
875442057f | |
|
|
905443f39f | |
|
|
abe7a7835c | |
|
|
5ddfa9c6b3 | |
|
|
e2dc9174e8 | |
|
|
08f378764a | |
|
|
51be1dfe0b | |
|
|
a9b3d222c4 | |
|
|
f7c0d367dc | |
|
|
6b65bbd86b | |
|
|
91a30c8967 | |
|
|
379d96b304 | |
|
|
9928d80daf | |
|
|
458525e2e1 | |
|
|
603ae2cb22 | |
|
|
a822fd7615 | |
|
|
fc7bf4dee4 | |
|
|
7092ce68af | |
|
|
c7e0311517 | |
|
|
fb418db538 | |
|
|
e9d4b6a4a8 | |
|
|
c15d3c1dab | |
|
|
acf62ef1cf | |
|
|
5e93462dd7 | |
|
|
3e7e72e70b | |
|
|
1c713e7c10 | |
|
|
74b0999f95 | |
|
|
39824d8c8b | |
|
|
c85e3e2e9c | |
|
|
c960e8630c | |
|
|
26731d2819 | |
|
|
64d5b7d83e | |
|
|
d7d1710d99 | |
|
|
59e497eacb | |
|
|
fc22d9c24d | |
|
|
34486e4ea5 | |
|
|
9b536f4259 | |
|
|
d2b27fba88 | |
|
|
0ec1f6aac8 | |
|
|
d8f5ba8ea5 | |
|
|
67d5be0f56 | |
|
|
78332e5be0 | |
|
|
49d61b7d3c | |
|
|
8bc0a97ad5 | |
|
|
cf2fca3441 | |
|
|
5889ca5415 | |
|
|
c0beff4ab7 | |
|
|
287004f70b | |
|
|
dfe42a4ff3 | |
|
|
805df52bdc | |
|
|
f8a590ea67 | |
|
|
2de3bc7edd | |
|
|
b0fba1b48b | |
|
|
cda79c4eca | |
|
|
0b1e6d38cf | |
|
|
d186d5fbd3 | |
|
|
3556e7c87b | |
|
|
5f00780fab | |
|
|
a8aa7832b7 | |
|
|
f13c8c20c2 | |
|
|
2ed2565fe4 | |
|
|
2d4a1324b6 | |
|
|
755bf3d42b | |
|
|
d9280190fb | |
|
|
6ac20c6a0a | |
|
|
bc03976da8 | |
|
|
4772fff681 | |
|
|
70ec42263a | |
|
|
2ff447be26 | |
|
|
3823bd18e8 | |
|
|
ec8419c516 | |
|
|
eec2336e62 | |
|
|
d168ea7f12 | |
|
|
ae16a03219 | |
|
|
5ece81efcb | |
|
|
bcb318771c | |
|
|
248aa303ce | |
|
|
83f6fe4f44 | |
|
|
067a618c4b | |
|
|
1448f05fb8 | |
|
|
685d0598cd | |
|
|
541e6f7d18 | |
|
|
578cce94f7 | |
|
|
ef31abdd13 | |
|
|
7a1d11ef60 | |
|
|
89810489a1 | |
|
|
129cf98bbd | |
|
|
054e720426 | |
|
|
20570d8eba | |
|
|
1c13755b25 | |
|
|
99e3569748 | |
|
|
e47cdb0036 | |
|
|
d29b6921ed | |
|
|
916959d5a6 | |
|
|
e44f0d773e | |
|
|
b9d4a8cc40 | |
|
|
ab389a9b82 | |
|
|
73874fa327 | |
|
|
369beaa158 | |
|
|
45c12f86c8 | |
|
|
89e93009ea | |
|
|
7b82bd29e4 | |
|
|
0a27822547 | |
|
|
ed9b3712a0 | |
|
|
1232e8529f | |
|
|
c7d479e43f |
|
|
@ -0,0 +1,2 @@
|
|||
tidelift: maven/org.slf4j:slf4j-api
|
||||
github: qos-ch
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners
|
||||
|
||||
concurrency:
|
||||
# On master/release, we don't want any jobs cancelled so the sha is used to name the group
|
||||
# On PR branches, we cancel the job if new commits are pushed
|
||||
# More info: https://stackoverflow.com/a/68422069/253468
|
||||
group: ${{ (github.ref == 'refs/heads/branch_1.2.18' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/release' ) && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
Test:
|
||||
name: JDK ${{ matrix.jdk }}, ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
jdk: [11, 17, 19]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
fail-fast: true
|
||||
max-parallel: 4
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 50
|
||||
- name: Set up Java ${{ matrix.jdk }}
|
||||
if: ${{ matrix.jdk != '8' }}
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: ${{ matrix.jdk }}
|
||||
- name: Install
|
||||
# download dependencies, etc, so test log looks better
|
||||
run: mvn -B install
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF8"?>
|
||||
<toolchains>
|
||||
<toolchain>
|
||||
<type>jdk</type>
|
||||
<provides>
|
||||
<version>1.8</version>
|
||||
</provides>
|
||||
<configuration>
|
||||
<jdkHome>${env.JAVA_HOME_8}</jdkHome>
|
||||
</configuration>
|
||||
</toolchain>
|
||||
</toolchains>
|
||||
|
|
@ -31,8 +31,8 @@
|
|||
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
|
||||
<option name="KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE" value="true" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
|
|
|
|||
14
.travis.yml
14
.travis.yml
|
|
@ -1,9 +1,21 @@
|
|||
dist: trusty
|
||||
|
||||
language: java
|
||||
|
||||
jdk:
|
||||
- openjdk8
|
||||
- oraclejdk11
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- notification@qos.ch
|
||||
|
||||
install: /bin/true
|
||||
|
||||
script:
|
||||
- mvn clean
|
||||
- mvn install
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
github: qos-ch
|
||||
73
README.md
73
README.md
|
|
@ -1,14 +1,69 @@
|
|||
# About SLF4J
|
||||
The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.
|
||||
|
||||
The Simple Logging Facade for Java (SLF4J) serves as a simple facade
|
||||
or abstraction for various logging frameworks (e.g. java.util.logging,
|
||||
logback, reload4j, log4j 2.x, logevents, penna, rainbowgum, tinylog)
|
||||
allowing the end user to plug in the desired logging framework at
|
||||
deployment time.
|
||||
|
||||
More information can be found on the [SLF4J website](http://www.slf4j.org).
|
||||
# Build Status
|
||||
[](https://travis-ci.org/qos-ch/slf4j)
|
||||
|
||||
# Search org.slf4j artifacts on Maven Central
|
||||
[](https://central.sonatype.com/search?namespace=org.slf4j)
|
||||
|
||||
|
||||
# In case of problems
|
||||
|
||||
In case of problems please do not hesitate to post an e-mail message
|
||||
on the [slf4j-user@qos.ch](https://mailman.qos.ch/cgi-bin/mailman/listinfo/slf4j-user)
|
||||
mailing list or to start a <a
|
||||
href="https://github.com/qos-ch/slf4j/discussions">discussion</a> on
|
||||
github. However, please do not directly e-mail SLF4J developers. The
|
||||
answer to your question might be useful to other users. Moreover,
|
||||
there are many knowledgeable users on the slf4j-user mailing lists who
|
||||
can quickly answer your questions.
|
||||
|
||||
# Urgent issues
|
||||
|
||||
For urgent issues do not hesitate to [champion a
|
||||
release](https://github.com/sponsors/qos-ch/sponsorships?tier_id=77436).
|
||||
In principle, most championed issues are solved within 3 business days
|
||||
ensued by a release.
|
||||
|
||||
# How to build SLF4J
|
||||
|
||||
SLF4J uses Maven as its build tool.
|
||||
|
||||
SLF4J version 2.0.x will run under Java 8 but requires Java 9 or later to build.
|
||||
|
||||
# How to contribute pull requests
|
||||
If you are interested in improving SLF4J, great! The SLF4J community looks forward to your contribution. Please follow this process:
|
||||
|
||||
1. Start a discussion on the [slf4j-dev mailing list](http://www.slf4j.org/mailing-lists.html) about your proposed change. Alternately file a [bug report](http://www.slf4j.org/bug-reporting.html).
|
||||
2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for your contribution to make it easier to merge your changes back.
|
||||
3. Make your changes on the branch you hopefuly created in Step 2. Be sure that your code passes existing unit tests. Please add unit tests for your work if appropriate. It usually is.
|
||||
4. Push your changes to your fork/branch in github. Don't push it to your master! If you do it will make it harder to submit new changes later.
|
||||
5. Submit a pull request to SLF4J from from your commit page on github.
|
||||
If you are interested in improving SLF4J, that is great! The SLF4J
|
||||
community looks forward to your contribution. Please follow this
|
||||
process:
|
||||
|
||||
1. Start a discussion on the [slf4j-dev mailing
|
||||
list](http://www.slf4j.org/mailing-lists.html) about your proposed
|
||||
change. Alternately, file a [bug
|
||||
report](https://github.com/qos-ch/slf4j/issues) on github to initiate the
|
||||
discussion.
|
||||
|
||||
2. Fork qos-ch/slf4j. Ideally, create a new branch from your fork for
|
||||
your contribution to make it easier to merge your changes back.
|
||||
|
||||
3. Make your changes on the branch created in Step 2. Be
|
||||
sure that your code passes existing unit tests. Please add unit tests
|
||||
for your work if appropriate. It usually is.
|
||||
|
||||
4. All commits must have signed off by the contributor attesting to
|
||||
[Developer Certificate of Origin
|
||||
(DCO)](https://developercertificate.org/). Commits without sign off
|
||||
will be automatically rejected by the [DCO GitHub
|
||||
check](https://probot.github.io/apps/dco/) application.
|
||||
|
||||
5. Push your changes to your fork/branch in GitHub. Don't push it to
|
||||
your master! If you do, it will make it harder to submit new changes
|
||||
later.
|
||||
|
||||
6. Submit a pull request to SLF4J from your commit page on GitHub.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
|
||||
## Reporting security issues
|
||||
|
||||
Please report security issues related to the SLF4J project to the
|
||||
following email address:
|
||||
|
||||
support(at)qos.ch
|
||||
|
||||
|
||||
|
||||
|
||||
## Verifying contents
|
||||
|
||||
All SLF4J project artifacts published on Maven central are signed. For
|
||||
each artifact, there is an associated signature file with the .asc
|
||||
suffix.
|
||||
|
||||
### After 2022-08-08
|
||||
|
||||
To verify the signature use [this public key](https://www.slf4j.org/public-keys/60200AC4AE761F1614D6C46766D68DAA073BE985.gpg). Here is its fingerprint:
|
||||
```
|
||||
pub nistp521 2022-08-08 [SC]
|
||||
60200AC4AE761F1614D6C46766D68DAA073BE985
|
||||
uid Ceki Gulcu <ceki@qos.ch>
|
||||
sub nistp521 2022-08-08 [E]
|
||||
```
|
||||
|
||||
A copy of this key is stored on the
|
||||
[keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to
|
||||
your public key ring use the following command:
|
||||
|
||||
```
|
||||
> FINGER_PRINT=60200AC4AE761F1614D6C46766D68DAA073BE985
|
||||
> gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT
|
||||
```
|
||||
|
||||
### Before 2022-08-08
|
||||
|
||||
To verify the signature use [this public key](https://www.slf4j.org/public-keys/ceki-public-key.pgp). Here is its fingerprint:
|
||||
|
||||
```
|
||||
pub 2048R/A511E325 2012-04-26
|
||||
Key fingerprint = 475F 3B8E 59E6 E63A A780 6748 2C7B 12F2 A511 E325
|
||||
uid Ceki Gulcu <ceki@qos.ch>
|
||||
sub 2048R/7FBFA159 2012-04-26
|
||||
```
|
||||
|
||||
A copy of this key is stored on the
|
||||
[keys.openpgp.org](https://keys.openpgp.org) keyserver. To add it to
|
||||
your public key ring use the following command:
|
||||
|
||||
```
|
||||
> FINGER_PRINT=475F3B8E59E6E63AA78067482C7B12F2A511E325
|
||||
> gpg --keyserver hkps://keys.openpgp.org --recv-keys $FINGER_PRINT
|
||||
```
|
||||
|
||||
|
||||
## Preventing commit history overwrite
|
||||
|
||||
In order to prevent loss of commit history, developers of the project
|
||||
are highly encouraged to deny branch deletions or history overwrites
|
||||
by invoking the following two commands on their local copy of the
|
||||
repository.
|
||||
|
||||
|
||||
```
|
||||
git config receive.denyDelete true
|
||||
git config receive.denyNonFastForwards true
|
||||
```
|
||||
|
|
@ -18,13 +18,6 @@
|
|||
|
||||
<!--<property name="path_to_policy" value="file:./integration/src/policy/java-under-ant.policy"/>-->
|
||||
|
||||
|
||||
<path id="path142Binding">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
<pathelement location="./lib/slf4j-simple-1.4.2.jar" />
|
||||
</path >
|
||||
|
||||
<path id="path150Binding">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
|
|
@ -43,32 +36,12 @@
|
|||
<pathelement location="./lib/slf4j-simple-1.5.11.jar" />
|
||||
</path >
|
||||
|
||||
<!--<path id="pathIncompatible">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
<pathelement location="./lib/slf4j-simple-INCOMPATIBLE.jar" />
|
||||
</path >
|
||||
-->
|
||||
|
||||
<path id="pathCurrent">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
|
||||
</path >
|
||||
|
||||
<path id="pathNoBinding">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
</path >
|
||||
|
||||
|
||||
<path id="incompatibleMultiBinding">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
|
||||
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
|
||||
</path >
|
||||
|
||||
<path id="multiBinding">
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
|
|
@ -99,41 +72,33 @@
|
|||
<!-- this is really very ugly, but it's the only way to circumvent
|
||||
http://jira.codehaus.org/browse/MANTRUN-95
|
||||
-->
|
||||
<!--
|
||||
<taskdef name="junit" classpath="${plugin_classpath};${compile_classpath}"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
|
||||
-->
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="target/unit-reports" />
|
||||
</target>
|
||||
|
||||
<target name="testAll" depends="init,
|
||||
testMissingSingletonMethod,
|
||||
testNoProvider150,
|
||||
testMismatch,
|
||||
testNoBinding,
|
||||
testMatch,
|
||||
testMultiBinding,
|
||||
testIncompatibleMultiBinding,
|
||||
testFuture_16Series,
|
||||
testActiveSecurityManager">
|
||||
testMatch,
|
||||
testMultiBinding,
|
||||
testFuture_16Series"
|
||||
>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="testMissingSingletonMethod">
|
||||
<target name="testNoProvider150">
|
||||
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="path142Binding" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-142BININDING"
|
||||
name="org.slf4j.MissingSingletonMethodAssertionTest" />
|
||||
</junit>
|
||||
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="path150Binding" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-150BINDING"
|
||||
name="org.slf4j.MissingSingletonMethodAssertionTest" />
|
||||
name="org.slf4j.NoProviderAssertionTest" />
|
||||
</junit>
|
||||
|
||||
</target>
|
||||
|
|
@ -153,15 +118,18 @@
|
|||
|
||||
<target name="testMismatch">
|
||||
|
||||
<!--
|
||||
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="path1511API" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-MISMATCH-1511API"
|
||||
name="org.slf4j.VersionMismatchAssertionTest" />
|
||||
name="org.slf4j.OldAPIVersionMismatchAssertionTest" />
|
||||
</junit>
|
||||
-->
|
||||
|
||||
|
||||
<!--
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="path1511Binding" />
|
||||
<formatter type="plain" />
|
||||
|
|
@ -169,6 +137,7 @@
|
|||
outfile="TEST-MISMATCH-1511Binding"
|
||||
name="org.slf4j.VersionMismatchAssertionTest" />
|
||||
</junit>
|
||||
-->
|
||||
|
||||
</target>
|
||||
|
||||
|
|
@ -180,16 +149,7 @@
|
|||
outfile="TEST-Match"
|
||||
name="org.slf4j.CompatibilityAssertionTest" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="testIncompatibleMultiBinding">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="incompatibleMultiBinding" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-IncompatibleMultiBinding"
|
||||
name="org.slf4j.IncompatibleMultiBindingAssertionTest" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="testMultiBinding">
|
||||
|
|
@ -202,13 +162,17 @@
|
|||
</junit>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="testFuture_16Series">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
|
||||
<!-- 1.8 uses providers and no longer supports bindings ==
|
||||
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="binding166" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-binding166"
|
||||
name="org.slf4j.CompatibilityAssertionTest" />
|
||||
name="org.slf4j.NoProviderAssertionTest" />
|
||||
</junit>
|
||||
|
||||
|
||||
|
|
@ -219,19 +183,9 @@
|
|||
outfile="TEST-api166"
|
||||
name="org.slf4j.CompatibilityAssertionTest" />
|
||||
</junit>
|
||||
-->
|
||||
</target>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="testNoBinding">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="pathNoBinding" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
outfile="TEST-NOBINDING"
|
||||
name="org.slf4j.helpers.NoBindingMultithreadedInitializationTest2" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
|
||||
<condition property="runFromWithinIntegrationModule">
|
||||
<contains string="${user.dir}" substring="integration" />
|
||||
|
|
@ -247,7 +201,7 @@
|
|||
<property name="path_to_policy" value="file:./src/policy/java-under-ant.policy"/>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- no longer supported in JDK 24 and later -->
|
||||
<target name="testActiveSecurityManager" depends="setPathToPolicy_FromTop, setPathToPolicy_FromIntegration">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<jvmarg value="-Djava.security.manager"/>
|
||||
|
|
|
|||
|
|
@ -13,15 +13,22 @@
|
|||
<echo message="test classpath: ${test_classpath}" />
|
||||
<echo message="basedir: ${basedir}" />
|
||||
|
||||
<echo message="ant.java.version: ${ant.java.version}" />
|
||||
|
||||
<property name="iBundleJar" value="target/iBundle.jar"/>
|
||||
<property name="bundlesDir" value="bundle"/>
|
||||
|
||||
|
||||
<!-- this is really very ugly, but it's the only way to circumvent
|
||||
http://jira.codehaus.org/browse/MANTRUN-95
|
||||
-->
|
||||
|
||||
<taskdef name="junit" classpath="${test_classpath}"
|
||||
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
|
||||
-->
|
||||
|
||||
<condition property="jdk9">
|
||||
<matches pattern="9.*" string="${ant.java.version}" />
|
||||
</condition>
|
||||
|
||||
<path id="minimal">
|
||||
<pathelement location="target/test-classes/" />
|
||||
|
|
@ -59,34 +66,45 @@
|
|||
|
||||
|
||||
<!-- for some reason if mvn is invoked from the parent directory, junit gets
|
||||
invoked from the parent dir, which messes up theses tests. Hence, the
|
||||
invoked from the parent dir, which messes up these tests. Hence, the
|
||||
fork="yes" dir="${basedir}" -->
|
||||
|
||||
<target name="nop">
|
||||
<!--
|
||||
<jvmarg line="MINUS_MINUSadd-opens java.base/java.net=ALL-UNNAMED"/>
|
||||
<jvmarg line="MINUS_MINUSadd-opens java.base/java.security=ALL-UNNAMED"/>
|
||||
-->
|
||||
|
||||
<target name="nop" unless="jdk9">
|
||||
<prepareOSGiHarness binding="nop"/>
|
||||
<junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
|
||||
<classpath path="${test_classpath}"/>
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" />
|
||||
<test todir="target/unit-reports"
|
||||
name="org.slf4j.test_osgi.BundleTest"
|
||||
outfile="OSGI-nop" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="simple">
|
||||
<target name="simple" unless="jdk9">
|
||||
<prepareOSGiHarness binding="simple"/>
|
||||
<junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
|
||||
<classpath path="${test_classpath}"/>
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
name="org.slf4j.test_osgi.BundleTest"
|
||||
outfile="OSGI-simple" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="jdk14">
|
||||
<target name="jdk14" unless="jdk9">
|
||||
<prepareOSGiHarness binding="jdk14"/>
|
||||
<junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
|
||||
<classpath path="${test_classpath}"/>
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports" name="org.slf4j.test_osgi.BundleTest" />
|
||||
<test fork="yes" todir="target/unit-reports"
|
||||
name="org.slf4j.test_osgi.BundleTest"
|
||||
outfile="OSGI-jdk14"/>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>integration</artifactId>
|
||||
|
|
@ -17,6 +18,14 @@
|
|||
<url>http://www.slf4j.org</url>
|
||||
<description>SLF4J integration tests</description>
|
||||
|
||||
<properties>
|
||||
<junit.version>4.10</junit.version>
|
||||
<!-- 1.9.1 does not work. Do not update lightly -->
|
||||
<ant-junit.version>1.9.0</ant-junit.version>
|
||||
<antrun-plugin.version>1.8</antrun-plugin.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
@ -24,17 +33,21 @@
|
|||
</dependency>
|
||||
|
||||
<!-- declaration to circumvent http://jira.codehaus.org/browse/MANTRUN-95 -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${junit3.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- declaration to circumvent http://jira.codehaus.org/browse/MANTRUN-95 -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>${ant-junit.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- some test run Felix in hosted mode -->
|
||||
<dependency>
|
||||
|
|
@ -49,17 +62,17 @@
|
|||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>${antrun-plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>${junit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ant</groupId>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant-junit</artifactId>
|
||||
<version>1.6.5</version>
|
||||
<version>${ant-junit.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
|
|
@ -80,6 +93,7 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<!-- OSGI integration with ServiceLoader mechanism fails at this stage
|
||||
<execution>
|
||||
<id>ant-osgi-test</id>
|
||||
<phase>package</phase>
|
||||
|
|
@ -95,7 +109,7 @@
|
|||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
|
||||
-->
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
|
@ -111,9 +125,19 @@
|
|||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@ Implementation-Title: iBundle
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: iBundle
|
||||
Bundle-Name: abundle
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: apack
|
||||
Import-Package: org.osgi.framework, org.slf4j;version=1.5
|
||||
|
|
@ -25,37 +25,47 @@
|
|||
|
||||
package org.slf4j;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.slf4j.helpers.Reporter.SLF4J_INTERNAL_VERBOSITY_KEY;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompatibilityAssertionTest extends TestCase {
|
||||
public class CompatibilityAssertionTest {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public CompatibilityAssertionTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
System.setProperty(SLF4J_INTERNAL_VERBOSITY_KEY, "debug");
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
System.clearProperty(SLF4J_INTERNAL_VERBOSITY_KEY);
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
assertEquals(1, sps.stringList.size());
|
||||
assertEquals(2, sps.stringList.size());
|
||||
|
||||
String s0 = (String) sps.stringList.get(0);
|
||||
assertTrue(s0.contains(msg));
|
||||
assertTrue(s0.startsWith("SLF4J(D): Connected with provider of type [org.slf4j.simple.SimpleServiceProvider]"));
|
||||
|
||||
String s1 = (String) sps.stringList.get(1);
|
||||
assertTrue(s1.contains(msg));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,33 +24,35 @@
|
|||
*/
|
||||
package org.slf4j;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IncompatibleMultiBindingAssertionTest extends TestCase {
|
||||
public class IncompatibleMultiBindingAssertionTest {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public IncompatibleMultiBindingAssertionTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
@Test
|
||||
public void smoke() throws Exception {
|
||||
try {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2016 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class MissingSingletonMethodAssertionTest extends TestCase {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public MissingSingletonMethodAssertionTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
try {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
fail("NoSuchMethodError expected");
|
||||
} catch (NoSuchMethodError e) {
|
||||
}
|
||||
|
||||
int lineCount = sps.stringList.size();
|
||||
assertTrue("number of lines should be 3 but was " + lineCount, lineCount == 3);
|
||||
|
||||
// expected output:
|
||||
// SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
|
||||
// SLF4J: Your binding is version 1.4.x or earlier.
|
||||
// SLF4J: Upgrade your binding to version 1.6.x. or 2.0.x
|
||||
|
||||
{
|
||||
String s = (String) sps.stringList.get(0);
|
||||
assertTrue(s.contains("SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding."));
|
||||
}
|
||||
{
|
||||
String s = (String) sps.stringList.get(1);
|
||||
assertTrue(s.contains("SLF4J: Your binding is version 1.5.5 or earlier."));
|
||||
}
|
||||
{
|
||||
String s = (String) sps.stringList.get(2);
|
||||
assertTrue(s.contains("SLF4J: Upgrade your binding to version 1.6.x."));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -28,38 +28,40 @@ import java.io.PrintStream;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class MultiBindingAssertionTest extends TestCase {
|
||||
public class MultiBindingAssertionTest {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public MultiBindingAssertionTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
List<String> list = sps.stringList;
|
||||
assertMsgContains(list, 0, "Class path contains multiple SLF4J bindings.");
|
||||
assertMsgContains(list, 1, "Found binding in");
|
||||
assertMsgContains(list, 2, "Found binding in");
|
||||
assertMsgContains(list, 3, "See http://www.slf4j.org/codes.html");
|
||||
assertMsgContains(list, 4, "Actual binding is of type [");
|
||||
int line = 0;
|
||||
|
||||
assertMsgContains(list, line++, "Class path contains multiple SLF4J providers.");
|
||||
assertMsgContains(list, line++, "Found provider");
|
||||
assertMsgContains(list, line++, "Found provider");
|
||||
assertMsgContains(list, line++, "See https://www.slf4j.org/codes.html#multiple_bindings for an explanation.");
|
||||
//assertMsgContains(list, line++, "SLF4J(D): Connected with provider of type [");
|
||||
}
|
||||
|
||||
void assertMsgContains(List<String> strList, int index, String msg) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2011 QOS.ch
|
||||
* Copyright (c) 2004-2016 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
|
@ -22,33 +22,36 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.impl;
|
||||
package org.slf4j;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RecursiveInitializationTest {
|
||||
public class NoProviderAssertionTest {
|
||||
|
||||
// value of LogManager.DEFAULT_CONFIGURATION_KEY;
|
||||
static String CONFIG_FILE_KEY = "log4j.configuration";
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
int diff = new Random().nextInt(10000);
|
||||
String loggerName = "org.slf4j.impl.RecursiveInitializationTest";
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
System.clearProperty(CONFIG_FILE_KEY);
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void loggingDuringInitialization() {
|
||||
System.setProperty(CONFIG_FILE_KEY, "recursiveInit.properties");
|
||||
Logger logger = LoggerFactory.getLogger(loggerName + ".loggingDuringInitialization-" + diff);
|
||||
logger.info("hello");
|
||||
public void test() throws Exception {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
OutputVerifier.noProvider(sps);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,36 +24,39 @@
|
|||
*/
|
||||
package org.slf4j;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class VersionMismatchAssertionTest extends TestCase {
|
||||
public class OldAPIVersionMismatchAssertionTest {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public VersionMismatchAssertionTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
|
||||
OutputVerifier.dump(sps);
|
||||
|
||||
String s0 = (String) sps.stringList.get(0);
|
||||
assertTrue(s0.matches("SLF4J: The requested version .* by your slf4j binding is not compatible with.*"));
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package org.slf4j;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
public class OutputVerifier {
|
||||
|
||||
static void noProvider(StringPrintStream sps) {
|
||||
dump(sps);
|
||||
int lineCount = sps.stringList.size();
|
||||
assertTrue("number of lines should be 6 but was " + lineCount, lineCount == 6);
|
||||
|
||||
// expected output: (version 1.8)
|
||||
// SLF4J: No SLF4J providers were found.
|
||||
// SLF4J: Defaulting to no-operation (NOP) logger implementation
|
||||
// SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
|
||||
// SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions prior to 1.8.
|
||||
// SLF4J: Ignoring binding found at
|
||||
// [jar:file:..../slf4j-simple-1.4.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
|
||||
// SLF4J: See http://www.slf4j.org/codes.html#ignoredBindings for an explanation.
|
||||
|
||||
{
|
||||
String s = (String) sps.stringList.get(0);
|
||||
assertTrue(s.contains("No SLF4J providers were found."));
|
||||
}
|
||||
{
|
||||
String s = (String) sps.stringList.get(1);
|
||||
assertTrue(s.contains("Defaulting to no-operation (NOP) logger implementation"));
|
||||
}
|
||||
{
|
||||
String s = (String) sps.stringList.get(2);
|
||||
assertTrue(s.contains("See https://www.slf4j.org/codes.html#noProviders for further details."));
|
||||
}
|
||||
|
||||
{
|
||||
String s = (String) sps.stringList.get(3);
|
||||
assertTrue(s.contains("Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier."));
|
||||
}
|
||||
|
||||
{
|
||||
String s = (String) sps.stringList.get(4);
|
||||
assertTrue(s.contains("Ignoring binding found at"));
|
||||
}
|
||||
{
|
||||
String s = (String) sps.stringList.get(5);
|
||||
assertTrue(s.contains("See https://www.slf4j.org/codes.html#ignoredBindings for an explanation"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void dump(StringPrintStream sps) {
|
||||
for (String s : sps.stringList) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public class StringPrintStream extends PrintStream {
|
|||
|
||||
public static final String LINE_SEP = System.getProperty("line.separator");
|
||||
PrintStream other;
|
||||
List<String> stringList = new ArrayList<String>();
|
||||
List<String> stringList = new ArrayList<>();
|
||||
|
||||
public StringPrintStream(PrintStream ps) {
|
||||
super(ps);
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2016 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.helpers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LoggerAccessingThread2 extends Thread {
|
||||
private static int LOOP_LEN = 64;
|
||||
|
||||
final CyclicBarrier barrier;
|
||||
final int count;
|
||||
final AtomicLong eventCount;
|
||||
List<Logger> loggerList;
|
||||
|
||||
public LoggerAccessingThread2(final CyclicBarrier barrier, List<Logger> loggerList, final int count, final AtomicLong eventCount) {
|
||||
this.barrier = barrier;
|
||||
this.loggerList = loggerList;
|
||||
this.count = count;
|
||||
this.eventCount = eventCount;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
barrier.await();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
String loggerNamePrefix = this.getClass().getName();
|
||||
for (int i = 0; i < LOOP_LEN; i++) {
|
||||
Logger logger = LoggerFactory.getLogger(loggerNamePrefix + "-" + count + "-" + i);
|
||||
loggerList.add(logger);
|
||||
Thread.yield();
|
||||
logger.info("in run method");
|
||||
eventCount.getAndIncrement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2016 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.event.EventRecodingLogger;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class NoBindingMultithreadedInitializationTest2 extends TestCase {
|
||||
final protected static int THREAD_COUNT = 4 + Runtime.getRuntime().availableProcessors() * 2;
|
||||
|
||||
private final List<Logger> createdLoggers = Collections.synchronizedList(new ArrayList<Logger>());
|
||||
|
||||
protected final AtomicLong eventCount = new AtomicLong(0);
|
||||
final private CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT + 1);
|
||||
|
||||
int diff = new Random().nextInt(10000);
|
||||
|
||||
|
||||
public NoBindingMultithreadedInitializationTest2(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void testNoBindingMultiThreadedInitialization() throws InterruptedException, BrokenBarrierException {
|
||||
@SuppressWarnings("unused")
|
||||
LoggerAccessingThread2[] accessors = harness();
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(getClass().getName());
|
||||
logger.info("hello");
|
||||
eventCount.getAndIncrement();
|
||||
|
||||
assertAllSubstLoggersAreFixed();
|
||||
long recordedEventCount = getRecordedEventCount();
|
||||
int LENIENCY_COUNT = 16;
|
||||
|
||||
long expectedEventCount = eventCount.get() + extraLogEvents();
|
||||
|
||||
assertTrue(expectedEventCount + " >= " + recordedEventCount, expectedEventCount >= recordedEventCount);
|
||||
assertTrue(expectedEventCount + " < " + recordedEventCount + "+" + LENIENCY_COUNT,
|
||||
expectedEventCount < recordedEventCount + LENIENCY_COUNT);
|
||||
}
|
||||
|
||||
protected int extraLogEvents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void assertAllSubstLoggersAreFixed() {
|
||||
for (Logger logger : createdLoggers) {
|
||||
if (logger instanceof SubstituteLogger) {
|
||||
SubstituteLogger substLogger = (SubstituteLogger) logger;
|
||||
if (substLogger.delegate() instanceof EventRecodingLogger)
|
||||
fail("substLogger " + substLogger.getName() + " has a delegate of type EventRecodingLogger");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LoggerAccessingThread2[] harness() throws InterruptedException, BrokenBarrierException {
|
||||
LoggerAccessingThread2[] threads = new LoggerAccessingThread2[THREAD_COUNT];
|
||||
for (int i = 0; i < THREAD_COUNT; i++) {
|
||||
threads[i] = new LoggerAccessingThread2(barrier, createdLoggers, i, eventCount);
|
||||
threads[i].start();
|
||||
}
|
||||
|
||||
// trigger barrier
|
||||
barrier.await();
|
||||
|
||||
for (int i = 0; i < THREAD_COUNT; i++) {
|
||||
threads[i].join();
|
||||
}
|
||||
|
||||
return threads;
|
||||
}
|
||||
|
||||
final String loggerName = this.getClass().getName();
|
||||
|
||||
protected long getRecordedEventCount() {
|
||||
return eventCount.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@ import junit.framework.TestCase;
|
|||
|
||||
public class Issue324Test extends TestCase {
|
||||
|
||||
public void testLoggerCreationInPresenseOfSecurityManager() {
|
||||
public void testLoggerCreationInPresenceOfSecurityManager() {
|
||||
String currentDir = System.getProperty("user.dir");
|
||||
System.out.println("currentDir:" + currentDir);
|
||||
Logger logger = LoggerFactory.getLogger(Issue324Test.class);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import org.osgi.framework.BundleListener;
|
|||
|
||||
public class CheckingBundleListener implements BundleListener {
|
||||
|
||||
List<BundleEvent> eventList = new ArrayList<BundleEvent>();
|
||||
List<BundleEvent> eventList = new ArrayList<>();
|
||||
|
||||
public void bundleChanged(BundleEvent be) {
|
||||
eventList.add(be);
|
||||
|
|
@ -45,16 +45,14 @@ public class CheckingBundleListener implements BundleListener {
|
|||
}
|
||||
|
||||
public void dumpAll() {
|
||||
for (int i = 0; i < eventList.size(); i++) {
|
||||
BundleEvent fe = (BundleEvent) eventList.get(i);
|
||||
for (BundleEvent fe : eventList) {
|
||||
dump(fe);
|
||||
}
|
||||
}
|
||||
|
||||
boolean exists(String bundleName) {
|
||||
for (int i = 0; i < eventList.size(); i++) {
|
||||
BundleEvent fe = (BundleEvent) eventList.get(i);
|
||||
Bundle b = fe.getBundle();
|
||||
for (BundleEvent bundleEvent : eventList) {
|
||||
Bundle b = bundleEvent.getBundle();
|
||||
System.out.println("===[" + b + "]");
|
||||
if (bundleName.equals(b.getSymbolicName())) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public class FelixHost {
|
|||
try {
|
||||
// Create host activator;
|
||||
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
List<Object> list = new ArrayList<>();
|
||||
|
||||
// list.add(new HostActivator());
|
||||
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.xml.sax, org.xml.sax.helpers, javax.xml.parsers, javax.naming");
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ import org.osgi.framework.FrameworkListener;
|
|||
|
||||
public class FrameworkErrorListener implements FrameworkListener {
|
||||
|
||||
public List<FrameworkEvent> errorList = new ArrayList<FrameworkEvent>();
|
||||
public List<FrameworkEvent> errorList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void frameworkEvent(FrameworkEvent fe) {
|
||||
if (fe.getType() == FrameworkEvent.ERROR) {
|
||||
errorList.add(fe);
|
||||
|
|
@ -54,9 +55,8 @@ public class FrameworkErrorListener implements FrameworkListener {
|
|||
}
|
||||
|
||||
public void dumpAll() {
|
||||
for (int i = 0; i < errorList.size(); i++) {
|
||||
FrameworkEvent fe = (FrameworkEvent) errorList.get(i);
|
||||
dump(fe);
|
||||
for (FrameworkEvent frameworkEvent : errorList) {
|
||||
dump(frameworkEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
@ -18,12 +19,16 @@
|
|||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<name>Apache-2.0</name>
|
||||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<module-name>org.apache.commons.logging</module-name>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
@ -35,6 +40,19 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<_exportcontents>org.apache.commons.logging*;version=${jcl.version};-noimport:=true</_exportcontents>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.commons.logging;
|
|||
* <p>A simple logging interface abstracting logging APIs. In order to be
|
||||
* instantiated successfully by {@link LogFactory}, classes that implement
|
||||
* this interface must have a constructor that takes a single String
|
||||
* parameter representing the "name" of this Log.</p>
|
||||
* parameter representing the "name" of this Log.
|
||||
*
|
||||
* <p> The six logging levels used by <code>Log</code> are (in order):
|
||||
* <ol>
|
||||
|
|
@ -34,27 +34,27 @@ package org.apache.commons.logging;
|
|||
* The mapping of these log levels to the concepts used by the underlying
|
||||
* logging system is implementation dependent.
|
||||
* The implementation should ensure, though, that this ordering behaves
|
||||
* as expected.</p>
|
||||
* as expected.
|
||||
*
|
||||
* <p>Performance is often a logging concern.
|
||||
* By examining the appropriate property,
|
||||
* a component can avoid expensive operations (producing information
|
||||
* to be logged).</p>
|
||||
* to be logged).
|
||||
*
|
||||
* <p> For example,
|
||||
* <code><pre>
|
||||
* <pre>
|
||||
* if (log.isDebugEnabled()) {
|
||||
* ... do something expensive ...
|
||||
* log.debug(theResult);
|
||||
* }
|
||||
* </pre></code>
|
||||
* </p>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>Configuration of the underlying logging system will generally be done
|
||||
* external to the Logging APIs, through whatever mechanism is supported by
|
||||
* that system.</p>
|
||||
* that system.
|
||||
*
|
||||
* <p style="color: #E40; font-weight: bold;">Please note that this interface is identical to that found in JCL 1.1.1.</p>
|
||||
* <p style="color: #E40; font-weight: bold;">Please note that this interface is identical to that found in JCL 1.1.1.
|
||||
*
|
||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||
* @author Rod Waldhoff
|
||||
|
|
@ -65,74 +65,74 @@ public interface Log {
|
|||
// ----------------------------------------------------- Logging Properties
|
||||
|
||||
/**
|
||||
* <p> Is debug logging currently enabled? </p>
|
||||
* <p> Is debug logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than debug. </p>
|
||||
* when the log level is more than debug.
|
||||
*/
|
||||
public boolean isDebugEnabled();
|
||||
|
||||
/**
|
||||
* <p> Is error logging currently enabled? </p>
|
||||
* <p> Is error logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than error. </p>
|
||||
* when the log level is more than error.
|
||||
*/
|
||||
public boolean isErrorEnabled();
|
||||
|
||||
/**
|
||||
* <p> Is fatal logging currently enabled? </p>
|
||||
* <p> Is fatal logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than fatal. </p>
|
||||
* when the log level is more than fatal.
|
||||
*/
|
||||
public boolean isFatalEnabled();
|
||||
|
||||
/**
|
||||
* <p> Is info logging currently enabled? </p>
|
||||
* <p> Is info logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than info. </p>
|
||||
* when the log level is more than info.
|
||||
*
|
||||
* @return true if info enabled, false otherwise
|
||||
*/
|
||||
public boolean isInfoEnabled();
|
||||
|
||||
/**
|
||||
* <p> Is trace logging currently enabled? </p>
|
||||
* <p> Is trace logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than trace. </p>
|
||||
* when the log level is more than trace.
|
||||
*
|
||||
* @return true if trace enabled, false otherwise
|
||||
*/
|
||||
public boolean isTraceEnabled();
|
||||
|
||||
/**
|
||||
* <p> Is warn logging currently enabled? </p>
|
||||
* <p> Is warn logging currently enabled?
|
||||
*
|
||||
* <p> Call this method to prevent having to perform expensive operations
|
||||
* (for example, <code>String</code> concatenation)
|
||||
* when the log level is more than warn. </p>
|
||||
* when the log level is more than warn.
|
||||
*/
|
||||
public boolean isWarnEnabled();
|
||||
|
||||
// -------------------------------------------------------- Logging Methods
|
||||
|
||||
/**
|
||||
* <p> Log a message with trace log level. </p>
|
||||
* <p> Log a message with trace log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void trace(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with trace log level. </p>
|
||||
* <p> Log an error with trace log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
@ -140,14 +140,14 @@ public interface Log {
|
|||
public void trace(Object message, Throwable t);
|
||||
|
||||
/**
|
||||
* <p> Log a message with debug log level. </p>
|
||||
* <p> Log a message with debug log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void debug(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with debug log level. </p>
|
||||
* <p> Log an error with debug log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
@ -155,14 +155,14 @@ public interface Log {
|
|||
public void debug(Object message, Throwable t);
|
||||
|
||||
/**
|
||||
* <p> Log a message with info log level. </p>
|
||||
* <p> Log a message with info log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void info(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with info log level. </p>
|
||||
* <p> Log an error with info log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
@ -170,14 +170,14 @@ public interface Log {
|
|||
public void info(Object message, Throwable t);
|
||||
|
||||
/**
|
||||
* <p> Log a message with warn log level. </p>
|
||||
* <p> Log a message with warn log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void warn(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with warn log level. </p>
|
||||
* <p> Log an error with warn log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
@ -185,14 +185,14 @@ public interface Log {
|
|||
public void warn(Object message, Throwable t);
|
||||
|
||||
/**
|
||||
* <p> Log a message with error log level. </p>
|
||||
* <p> Log a message with error log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void error(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with error log level. </p>
|
||||
* <p> Log an error with error log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
@ -200,14 +200,14 @@ public interface Log {
|
|||
public void error(Object message, Throwable t);
|
||||
|
||||
/**
|
||||
* <p> Log a message with fatal log level. </p>
|
||||
* <p> Log a message with fatal log level.
|
||||
*
|
||||
* @param message log this message
|
||||
*/
|
||||
public void fatal(Object message);
|
||||
|
||||
/**
|
||||
* <p> Log an error with fatal log level. </p>
|
||||
* <p> Log an error with fatal log level.
|
||||
*
|
||||
* @param message log this message
|
||||
* @param t log this cause
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package org.apache.commons.logging;
|
|||
* An exception that is thrown only if a suitable <code>LogFactory</code> or
|
||||
* <code>Log</code> instance cannot be created by the corresponding factory
|
||||
* methods.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* In this version of JCL, this exception will never be thrown in practice.
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.apache.commons.logging.impl.SLF4JLogFactory;
|
|||
* Factory for creating {@link Log} instances, which always delegates to an
|
||||
* instance of {@link SLF4JLogFactory}.
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Craig R. McClanahan
|
||||
* @author Costin Manolache
|
||||
|
|
@ -170,7 +170,7 @@ public abstract class LogFactory {
|
|||
* <p>
|
||||
* Construct (if necessary) and return a <code>Log</code> instance, using
|
||||
* the factory's current set of configuration attributes.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* <strong>NOTE </strong>- Depending upon the implementation of the
|
||||
|
|
@ -178,7 +178,7 @@ public abstract class LogFactory {
|
|||
* you are returned may or may not be local to the current application, and
|
||||
* may or may not be returned again on a subsequent call with the same name
|
||||
* argument.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* Logical name of the <code>Log</code> instance to be
|
||||
|
|
@ -229,7 +229,7 @@ public abstract class LogFactory {
|
|||
* Construct (if necessary) and return a <code>LogFactory</code> instance,
|
||||
* using the following ordered lookup procedure to determine the name of the
|
||||
* implementation class to be loaded.
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>The <code>org.apache.commons.logging.LogFactory</code> system
|
||||
* property.</li>
|
||||
|
|
@ -248,7 +248,7 @@ public abstract class LogFactory {
|
|||
* <code>LogFactory</code> implementation class is utilized, all of the
|
||||
* properties defined in this file will be set as configuration attributes on
|
||||
* the corresponding <code>LogFactory</code> instance.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @exception LogConfigurationException
|
||||
* if the implementation class is not available or cannot
|
||||
|
|
@ -345,64 +345,64 @@ public abstract class LogFactory {
|
|||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static Object createFactory(String factoryClass, ClassLoader classLoader) {
|
||||
throw new UnsupportedOperationException("Operation [factoryClass] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [factoryClass] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static ClassLoader directGetContextClassLoader() {
|
||||
throw new UnsupportedOperationException("Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [directGetContextClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static ClassLoader getContextClassLoader() throws LogConfigurationException {
|
||||
throw new UnsupportedOperationException("Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [getContextClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static ClassLoader getClassLoader(Class clazz) {
|
||||
throw new UnsupportedOperationException("Operation [getClassLoader] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [getClassLoader] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static boolean isDiagnosticsEnabled() {
|
||||
throw new UnsupportedOperationException("Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [isDiagnosticsEnabled] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static void logRawDiagnostic(String msg) {
|
||||
throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader, final ClassLoader contextClassLoader) {
|
||||
throw new UnsupportedOperationException("Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [logRawDiagnostic] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method exists to ensure signature compatibility.
|
||||
*/
|
||||
protected static LogFactory newFactory(final String factoryClass, final ClassLoader classLoader) {
|
||||
throw new UnsupportedOperationException("Operation [newFactory] is not supported in jcl-over-slf4j. See also "
|
||||
+ UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
throw new UnsupportedOperationException(
|
||||
"Operation [newFactory] is not supported in jcl-over-slf4j. See also " + UNSUPPORTED_OPERATION_IN_JCL_OVER_SLF4J);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
|
|||
* <p>
|
||||
* Trivial implementation of Log that throws away all messages. No configurable
|
||||
* system properties are supported.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||
* @author Rod Waldhoff
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
|
|||
|
||||
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
||||
// logger instance is transient
|
||||
private transient LocationAwareLogger logger;
|
||||
private final transient LocationAwareLogger logger;
|
||||
|
||||
private static final String FQCN = SLF4JLocationAwareLog.class.getName();
|
||||
|
||||
SLF4JLocationAwareLog(LocationAwareLogger logger) {
|
||||
public SLF4JLocationAwareLog(LocationAwareLogger logger) {
|
||||
this.logger = logger;
|
||||
this.name = logger.getName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ public class SLF4JLog implements Log, Serializable {
|
|||
|
||||
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
||||
// logger instance is transient
|
||||
private transient Logger logger;
|
||||
private final transient Logger logger;
|
||||
|
||||
SLF4JLog(Logger logger) {
|
||||
public SLF4JLog(Logger logger) {
|
||||
this.logger = logger;
|
||||
this.name = logger.getName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
*
|
||||
* <p>
|
||||
* This implementation ignores any configured attributes.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Rod Waldhoff
|
||||
* @author Craig R. McClanahan
|
||||
|
|
@ -64,7 +64,7 @@ public class SLF4JLogFactory extends LogFactory {
|
|||
* Public no-arguments constructor required by the lookup mechanism.
|
||||
*/
|
||||
public SLF4JLogFactory() {
|
||||
loggerMap = new ConcurrentHashMap<String, Log>();
|
||||
loggerMap = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- Manifest Constants
|
||||
|
|
@ -105,12 +105,12 @@ public class SLF4JLogFactory extends LogFactory {
|
|||
@SuppressWarnings("unchecked")
|
||||
public String[] getAttributeNames() {
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
Enumeration<String> keys = attributes.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
names.add((String) keys.nextElement());
|
||||
}
|
||||
String results[] = new String[names.size()];
|
||||
String[] results = new String[names.size()];
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
results[i] = (String) names.get(i);
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ public class SLF4JLogFactory extends LogFactory {
|
|||
* <p>
|
||||
* Construct (if necessary) and return a <code>Log</code> instance, using
|
||||
* the factory's current set of configuration attributes.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* Logical name of the <code>Log</code> instance to be returned
|
||||
|
|
@ -173,12 +173,10 @@ public class SLF4JLogFactory extends LogFactory {
|
|||
public void release() {
|
||||
// This method is never called by jcl-over-slf4j classes. However,
|
||||
// in certain deployment scenarios, in particular if jcl-over-slf4j.jar
|
||||
// is
|
||||
// in the the web-app class loader and the official commons-logging.jar is
|
||||
// deployed in some parent class loader (e.g. commons/lib), then it is
|
||||
// possible
|
||||
// for the parent class loader to mask the classes shipping in
|
||||
// jcl-over-slf4j.jar.
|
||||
// is in the web-app class loader and the official commons-logging.jar
|
||||
// is deployed in some parent class loader (e.g. commons/lib), then it
|
||||
// is possible for the parent class loader to mask the classes shipping
|
||||
// in jcl-over-slf4j.jar.
|
||||
System.out.println("WARN: The method " + SLF4JLogFactory.class + "#release() was invoked.");
|
||||
System.out.println("WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.");
|
||||
System.out.flush();
|
||||
|
|
@ -216,4 +214,4 @@ public class SLF4JLogFactory extends LogFactory {
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.apache.commons.logging.LogConfigurationException;
|
|||
* Simple implementation of Log that sends all enabled log messages, for all
|
||||
* defined loggers, to System.err. The following system properties are supported
|
||||
* to configure the behavior of this logger:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li><code>org.apache.commons.logging.simplelog.defaultlog</code> - Default
|
||||
* logging detail level for all instances of SimpleLog. Must be one of ("trace",
|
||||
|
|
@ -67,7 +67,7 @@ import org.apache.commons.logging.LogConfigurationException;
|
|||
* this implementation also checks for a class loader resource named
|
||||
* <code>"simplelog.properties"</code>, and includes any matching definitions
|
||||
* from this resource (if it exists).
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
|
||||
* @author Rod Waldhoff
|
||||
|
|
@ -165,7 +165,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
} catch (java.io.IOException e) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showLogName = getBooleanProperty(systemPrefix + "showlogname", showLogName);
|
||||
|
|
@ -248,7 +248,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Set logging level.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param currentLogLevel
|
||||
* new logging level
|
||||
|
|
@ -262,7 +262,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Get logging level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public int getLevel() {
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
* <p>
|
||||
* Do the actual logging. This method assembles the message and then calls
|
||||
* <code>write()</code> to cause it to be written.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* One of the LOG_LEVEL_XXX constants defining the log level
|
||||
|
|
@ -354,7 +354,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
* Write the content of the message accumulated in the specified
|
||||
* <code>StringBuffer</code> to the appropriate output destination. The
|
||||
* default implementation writes to <code>System.err</code>.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param buffer
|
||||
* A <code>StringBuffer</code> containing the accumulated text to be
|
||||
|
|
@ -383,7 +383,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with debug log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void debug(Object message) {
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with debug log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void debug(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with trace log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void trace(Object message) {
|
||||
|
||||
|
|
@ -419,7 +419,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with trace log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void trace(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with info log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void info(Object message) {
|
||||
|
||||
|
|
@ -443,7 +443,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with info log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void info(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -455,7 +455,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with warn log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void warn(Object message) {
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with warn log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void warn(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with error log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void error(Object message) {
|
||||
|
||||
|
|
@ -491,7 +491,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with error log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void error(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -503,7 +503,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log a message with fatal log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void fatal(Object message) {
|
||||
|
||||
|
|
@ -515,7 +515,7 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Log an error with fatal log level.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final void fatal(Object message, Throwable t) {
|
||||
|
||||
|
|
@ -527,12 +527,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are debug messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isDebugEnabled() {
|
||||
|
||||
|
|
@ -542,12 +542,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are error messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isErrorEnabled() {
|
||||
|
||||
|
|
@ -557,12 +557,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are fatal messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isFatalEnabled() {
|
||||
|
||||
|
|
@ -572,12 +572,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are info messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isInfoEnabled() {
|
||||
|
||||
|
|
@ -587,12 +587,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are trace messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isTraceEnabled() {
|
||||
|
||||
|
|
@ -602,12 +602,12 @@ public class SimpleLog implements Log, Serializable {
|
|||
/**
|
||||
* <p>
|
||||
* Are warn messages currently enabled?
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This allows expensive operations such as <code>String</code> concatenation
|
||||
* to be avoided when the message will be ignored by the logger.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public final boolean isWarnEnabled() {
|
||||
|
||||
|
|
@ -673,15 +673,13 @@ public class SimpleLog implements Log, Serializable {
|
|||
}
|
||||
|
||||
private static InputStream getResourceAsStream(final String name) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
|
||||
public InputStream run() {
|
||||
ClassLoader threadCL = getContextClassLoader();
|
||||
return AccessController.doPrivileged((PrivilegedAction<InputStream>) () -> {
|
||||
ClassLoader threadCL = getContextClassLoader();
|
||||
|
||||
if (threadCL != null) {
|
||||
return threadCL.getResourceAsStream(name);
|
||||
} else {
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
}
|
||||
if (threadCL != null) {
|
||||
return threadCL.getResourceAsStream(name);
|
||||
} else {
|
||||
return ClassLoader.getSystemResourceAsStream(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ replacement for the original JCL version 1.0.4.
|
|||
<p>As the original JCL version 1.0.4, the present version supports
|
||||
various logging APIs. It differs from the original in implementation
|
||||
but not the public API. This implementation uses SLF4J under the
|
||||
covers. As as such, all the logging systems that SLF4J supports,
|
||||
covers. As such, all the logging systems that SLF4J supports,
|
||||
e.g. NOP, Simple, JDK14, nlog4j are supported by this version of JCL.
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
module org.apache.commons.logging {
|
||||
requires org.slf4j;
|
||||
exports org.apache.commons.logging;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
Implementation-Title: jcl-over-slf4j
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: jcl.over.slf4j
|
||||
Bundle-Name: jcl-over-slf4j
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.apache.commons.logging
|
||||
Export-Package: org.apache.commons.logging;version=1.2,
|
||||
org.apache.commons.logging.impl;version=1.2
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion}, org.slf4j.spi;version=${parsedVersion.osgiVersion}
|
||||
|
|
@ -23,12 +23,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
package org.apache.commons.logging;
|
||||
package org.apache.commons.logging.test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class InvokeJCLTest {
|
||||
|
|
@ -129,7 +132,9 @@ public class InvokeJCLTest {
|
|||
private final String msg;
|
||||
int invokedCount = 0;
|
||||
|
||||
TestMessage(String msg) {this.msg = msg;}
|
||||
TestMessage(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.apache.commons.logging.impl;
|
||||
package org.apache.commons.logging.test;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
|
@ -32,10 +32,12 @@ import java.io.ObjectOutputStream;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.logging.impl.SLF4JLocationAwareLog;
|
||||
import org.apache.commons.logging.impl.SLF4JLog;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.impl.JDK14LoggerFactory;
|
||||
import org.slf4j.jul.JDK14LoggerFactory;
|
||||
import org.slf4j.spi.LocationAwareLogger;
|
||||
|
||||
public class SerializationTest {
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>jul-to-slf4j</artifactId>
|
||||
|
|
@ -25,10 +26,15 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -39,12 +39,12 @@ import org.slf4j.spi.LocationAwareLogger;
|
|||
// Based on http://jira.qos.ch/browse/SLF4J-30
|
||||
|
||||
/**
|
||||
* <p>Bridge/route all JUL log records to the SLF4J API.</p>
|
||||
* <p>Bridge/route all JUL log records to the SLF4J API.
|
||||
* <p>Essentially, the idea is to install on the root logger an instance of
|
||||
* <code>SLF4JBridgeHandler</code> as the sole JUL handler in the system. Subsequently, the
|
||||
* SLF4JBridgeHandler instance will redirect all JUL log records are redirected
|
||||
* to the SLF4J API based on the following mapping of levels:
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* FINEST -> TRACE
|
||||
* FINER -> DEBUG
|
||||
|
|
@ -52,7 +52,7 @@ import org.slf4j.spi.LocationAwareLogger;
|
|||
* INFO -> INFO
|
||||
* WARNING -> WARN
|
||||
* SEVERE -> ERROR</pre>
|
||||
* <p><b>Programmatic installation:</b></p>
|
||||
* <p><b>Programmatic installation:</b>
|
||||
* <pre>
|
||||
* // Optionally remove existing handlers attached to j.u.l root logger
|
||||
* SLF4JBridgeHandler.removeHandlersForRootLogger(); // (since SLF4J 1.6.5)
|
||||
|
|
@ -60,12 +60,12 @@ import org.slf4j.spi.LocationAwareLogger;
|
|||
* // add SLF4JBridgeHandler to j.u.l's root logger, should be done once during
|
||||
* // the initialization phase of your application
|
||||
* SLF4JBridgeHandler.install();</pre>
|
||||
* <p><b>Installation via <em>logging.properties</em> configuration file:</b></p>
|
||||
* <p><b>Installation via <em>logging.properties</em> configuration file:</b>
|
||||
* <pre>
|
||||
* // register SLF4JBridgeHandler as handler for the j.u.l. root logger
|
||||
* handlers = org.slf4j.bridge.SLF4JBridgeHandler</pre>
|
||||
* <p>Once SLF4JBridgeHandler is installed, logging by j.u.l. loggers will be directed to
|
||||
* SLF4J. Example: </p>
|
||||
* SLF4J. Example:
|
||||
* <pre>
|
||||
* import java.util.logging.Logger;
|
||||
* ...
|
||||
|
|
@ -79,17 +79,26 @@ import org.slf4j.spi.LocationAwareLogger;
|
|||
* SLF4J translation can seriously increase the cost of disabled logging
|
||||
* statements (60 fold or 6000% increase) and measurably impact the performance of enabled log
|
||||
* statements (20% overall increase).</b> Please note that as of logback-version 0.9.25,
|
||||
* it is possible to completely eliminate the 60 fold translation overhead for disabled
|
||||
* it is possible to completely eliminate the 60-fold translation overhead for disabled
|
||||
* log statements with the help of <a href="http://logback.qos.ch/manual/configuration.html#LevelChangePropagator">LevelChangePropagator</a>.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>If you are concerned about application performance, then use of <code>SLF4JBridgeHandler</code>
|
||||
* is appropriate only if any one the following two conditions is true:</p>
|
||||
* is appropriate only if any of the following conditions is true:
|
||||
* <ol>
|
||||
* <li>few j.u.l. logging statements are in play</li>
|
||||
* <li>LevelChangePropagator has been installed</li>
|
||||
* </ol>
|
||||
*
|
||||
* <h2>As a Java 9/Jigsaw module</h2>
|
||||
*
|
||||
* <p>Given that <b>to</b> is a reserved keyword under Java 9 within module productions,
|
||||
* the MANIFEST.MF file in <em>jul-to-slf4j.jar</em> declares <b>jul_to_slf4j</b> as
|
||||
* its Automatic Module Name. Thus, if your application is Jigsaw modularized, the requires
|
||||
* statement in your <em>module-info.java</em> needs to be <b>jul_to_slf4j</b>
|
||||
* (note the two underscores).
|
||||
*
|
||||
*
|
||||
* @author Christian Stein
|
||||
* @author Joern Huxhorn
|
||||
* @author Ceki Gülcü
|
||||
|
|
@ -109,9 +118,8 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
|
||||
/**
|
||||
* Adds a SLF4JBridgeHandler instance to jul's root logger.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
|
||||
*
|
||||
* <p>This handler will redirect j.u.l. logging to SLF4J. However, only logs enabled
|
||||
* in j.u.l. will be redirected. For example, if a log statement invoking a
|
||||
* j.u.l. logger is disabled, then the corresponding non-event will <em>not</em>
|
||||
* reach SLF4JBridgeHandler and cannot be redirected.
|
||||
|
|
@ -135,9 +143,9 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
public static void uninstall() throws SecurityException {
|
||||
java.util.logging.Logger rootLogger = getRootLogger();
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i++) {
|
||||
if (handlers[i] instanceof SLF4JBridgeHandler) {
|
||||
rootLogger.removeHandler(handlers[i]);
|
||||
for (Handler handler : handlers) {
|
||||
if (handler instanceof SLF4JBridgeHandler) {
|
||||
rootLogger.removeHandler(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,14 +153,14 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
/**
|
||||
* Returns true if SLF4JBridgeHandler has been previously installed, returns false otherwise.
|
||||
*
|
||||
* @return true if SLF4JBridgeHandler is already installed, false other wise
|
||||
* @throws SecurityException
|
||||
* @return true if SLF4JBridgeHandler is already installed, false otherwise
|
||||
*
|
||||
*/
|
||||
public static boolean isInstalled() throws SecurityException {
|
||||
public static boolean isInstalled() {
|
||||
java.util.logging.Logger rootLogger = getRootLogger();
|
||||
Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i++) {
|
||||
if (handlers[i] instanceof SLF4JBridgeHandler) {
|
||||
for (Handler handler : handlers) {
|
||||
if (handler instanceof SLF4JBridgeHandler) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -166,8 +174,8 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
public static void removeHandlersForRootLogger() {
|
||||
java.util.logging.Logger rootLogger = getRootLogger();
|
||||
java.util.logging.Handler[] handlers = rootLogger.getHandlers();
|
||||
for (int i = 0; i < handlers.length; i++) {
|
||||
rootLogger.removeHandler(handlers[i]);
|
||||
for (Handler handler : handlers) {
|
||||
rootLogger.removeHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -193,6 +201,9 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
|
||||
/**
|
||||
* Return the Logger instance that will be used for logging.
|
||||
*
|
||||
* @param record a LogRecord
|
||||
* @return an SLF4J logger corresponding to the record parameter's logger name
|
||||
*/
|
||||
protected Logger getSLF4JLogger(LogRecord record) {
|
||||
String name = record.getLoggerName();
|
||||
|
|
@ -274,10 +285,10 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
|
||||
/**
|
||||
* Publish a LogRecord.
|
||||
* <p/>
|
||||
* <p>
|
||||
* The logging request was made initially to a Logger object, which
|
||||
* initialized the LogRecord and forwarded it here.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This handler ignores the Level attached to the LogRecord, as SLF4J cares
|
||||
* about discarding log statements.
|
||||
*
|
||||
|
|
@ -291,13 +302,12 @@ public class SLF4JBridgeHandler extends Handler {
|
|||
}
|
||||
|
||||
Logger slf4jLogger = getSLF4JLogger(record);
|
||||
String message = record.getMessage(); // can be null!
|
||||
// this is a check to avoid calling the underlying logging system
|
||||
// with a null message. While it is legitimate to invoke j.u.l. with
|
||||
// a null message, other logging frameworks do not support this.
|
||||
// see also http://jira.qos.ch/browse/SLF4J-99
|
||||
if (message == null) {
|
||||
message = "";
|
||||
if (record.getMessage() == null) {
|
||||
record.setMessage("");
|
||||
}
|
||||
if (slf4jLogger instanceof LocationAwareLogger) {
|
||||
callLocationAwareLogger((LocationAwareLogger) slf4jLogger, record);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
<p>Bridge/route all JUL log records to the SLF4J API.</p>
|
||||
|
||||
<hr/>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
module jul.to.slf4j {
|
||||
|
||||
requires org.slf4j;
|
||||
requires java.logging;
|
||||
|
||||
exports org.slf4j.bridge;
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: jul.to.slf4j
|
||||
Bundle-Name: jul-to-slf4j
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Export-Package: org.slf4j.bridge;version=${parsedVersion.osgiVersion};uses:="org.slf4j,org.slf4j.spi"
|
||||
Import-Package: org.slf4j;version=${parsedVersion.osgiVersion},org.slf4j.spi;version=${parsedVersion.osgiVersion}
|
||||
|
|
@ -32,7 +32,7 @@ import org.apache.log4j.spi.LoggingEvent;
|
|||
|
||||
public class ListAppender extends AppenderSkeleton {
|
||||
|
||||
public List<LoggingEvent> list = new ArrayList<LoggingEvent>();
|
||||
public List<LoggingEvent> list = new ArrayList<>();
|
||||
|
||||
public boolean extractLocationInfo = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ public class SLF4JBridgeHandlerPerfTest {
|
|||
fileAppender = new FileAppender(new PatternLayout("%r [%t] %p %c %x - %m%n"), "target/test-output/toto.log");
|
||||
|
||||
existingHandlers = julRootLogger.getHandlers();
|
||||
for (int i = 0; i < existingHandlers.length; i++) {
|
||||
julRootLogger.removeHandler(existingHandlers[i]);
|
||||
for (Handler existingHandler : existingHandlers) {
|
||||
julRootLogger.removeHandler(existingHandler);
|
||||
}
|
||||
log4jRoot = org.apache.log4j.Logger.getRootLogger();
|
||||
log4jRoot.addAppender(fileAppender);
|
||||
|
|
@ -68,8 +68,8 @@ public class SLF4JBridgeHandlerPerfTest {
|
|||
SLF4JBridgeHandler.uninstall();
|
||||
fileAppender.close();
|
||||
log4jRoot.getLoggerRepository().resetConfiguration();
|
||||
for (int i = 0; i < existingHandlers.length; i++) {
|
||||
julRootLogger.addHandler(existingHandlers[i]);
|
||||
for (Handler existingHandler : existingHandlers) {
|
||||
julRootLogger.addHandler(existingHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,14 +42,16 @@ public class SLF4JBridgeHandlerTest {
|
|||
|
||||
ListAppender listAppender = new ListAppender();
|
||||
org.apache.log4j.Logger log4jRoot;
|
||||
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger("yay");
|
||||
|
||||
java.util.logging.Logger julLogger = java.util.logging.Logger.getLogger(LOGGER_NAME);
|
||||
java.util.logging.Logger julRootLogger = java.util.logging.Logger.getLogger("");
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
listAppender.extractLocationInfo = true;
|
||||
log4jRoot = org.apache.log4j.Logger.getRootLogger();
|
||||
log4jRoot.addAppender(listAppender);
|
||||
log4jRoot.setLevel(org.apache.log4j.Level.TRACE);
|
||||
julRootLogger.setLevel(Level.FINEST);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
@ -61,6 +63,7 @@ public class SLF4JBridgeHandlerTest {
|
|||
@Test
|
||||
public void testSmoke() {
|
||||
SLF4JBridgeHandler.install();
|
||||
|
||||
String msg = "msg";
|
||||
julLogger.info(msg);
|
||||
assertEquals(1, listAppender.list.size());
|
||||
|
|
@ -77,6 +80,19 @@ public class SLF4JBridgeHandlerTest {
|
|||
assertEquals("SLF4JBridgeHandlerTest.java", li.getFileName());
|
||||
assertEquals("testSmoke", li.getMethodName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void LOGBACK_1612() {
|
||||
SLF4JBridgeHandler.install();
|
||||
|
||||
String msg = "LOGBACK_1612";
|
||||
julLogger.finer(msg);
|
||||
assertEquals(1, listAppender.list.size());
|
||||
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
|
||||
assertEquals(LOGGER_NAME, le.getLoggerName());
|
||||
assertEquals(msg, le.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLevels() {
|
||||
|
|
@ -101,6 +117,8 @@ public class SLF4JBridgeHandlerTest {
|
|||
assertLevel(i++, org.apache.log4j.Level.ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testLogWithResourceBundle() {
|
||||
SLF4JBridgeHandler.install();
|
||||
|
|
@ -115,7 +133,7 @@ public class SLF4JBridgeHandlerTest {
|
|||
|
||||
julResourceBundleLogger.info(msg);
|
||||
assertEquals(1, listAppender.list.size());
|
||||
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
|
||||
LoggingEvent le = listAppender.list.get(0);
|
||||
assertEquals(LOGGER_NAME, le.getLoggerName());
|
||||
assertEquals(expectedMsg, le.getMessage());
|
||||
}
|
||||
|
|
@ -149,19 +167,19 @@ public class SLF4JBridgeHandlerTest {
|
|||
|
||||
LoggingEvent le = null;
|
||||
|
||||
le = (LoggingEvent) listAppender.list.get(0);
|
||||
le = listAppender.list.get(0);
|
||||
assertEquals("foo", le.getLoggerName());
|
||||
assertEquals(expectedMsg1, le.getMessage());
|
||||
|
||||
le = (LoggingEvent) listAppender.list.get(1);
|
||||
le = listAppender.list.get(1);
|
||||
assertEquals("foo", le.getLoggerName());
|
||||
assertEquals(expectedMsg2, le.getMessage());
|
||||
|
||||
le = (LoggingEvent) listAppender.list.get(2);
|
||||
le = listAppender.list.get(2);
|
||||
assertEquals("foo", le.getLoggerName());
|
||||
assertEquals(expectedMsg3, le.getMessage());
|
||||
|
||||
le = (LoggingEvent) listAppender.list.get(3);
|
||||
le = listAppender.list.get(3);
|
||||
assertEquals("yay", le.getLoggerName());
|
||||
assertEquals(expectedMsg3, le.getMessage());
|
||||
}
|
||||
|
|
@ -173,7 +191,7 @@ public class SLF4JBridgeHandlerTest {
|
|||
julLogger.logp(Level.INFO, "SLF4JBridgeHandlerTest", "testLogWithPlaceholderNoParameters", msg, new Object[0]);
|
||||
|
||||
assertEquals(1, listAppender.list.size());
|
||||
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
|
||||
LoggingEvent le = listAppender.list.get(0);
|
||||
assertEquals(LOGGER_NAME, le.getLoggerName());
|
||||
assertEquals(msg, le.getMessage());
|
||||
}
|
||||
|
|
@ -187,12 +205,22 @@ public class SLF4JBridgeHandlerTest {
|
|||
|
||||
julLogger.log(Level.INFO, msg, "ignored parameter due to IllegalArgumentException");
|
||||
assertEquals(1, listAppender.list.size());
|
||||
LoggingEvent le = (LoggingEvent) listAppender.list.get(0);
|
||||
LoggingEvent le = listAppender.list.get(0);
|
||||
assertEquals(msg, le.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void withNullMessage() {
|
||||
SLF4JBridgeHandler.install();
|
||||
String msg = null;
|
||||
julLogger.log(Level.INFO, msg);
|
||||
assertEquals(1, listAppender.list.size());
|
||||
LoggingEvent le = listAppender.list.get(0);
|
||||
assertEquals("", le.getMessage());
|
||||
}
|
||||
|
||||
void assertLevel(int index, org.apache.log4j.Level expectedLevel) {
|
||||
LoggingEvent le = (LoggingEvent) listAppender.list.get(index);
|
||||
LoggingEvent le = listAppender.list.get(index);
|
||||
assertEquals(expectedLevel, le.getLevel());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,176 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
|
@ -1,137 +0,0 @@
|
|||
<project name="testing-log4j-bridge" default="usage" basedir=".">
|
||||
|
||||
<property name="lbversion" value="0.9.8-SNAPSHOT" />
|
||||
<property name="slf4jversion" value="1.4.2" />
|
||||
<property name="source.home" value="./src/main/java/" />
|
||||
<property name="javac.dest.12" value="./target/classes12/" />
|
||||
<property name="javac.dest.13" value="./target/classes13/" />
|
||||
<property name="lib" value="./lib" />
|
||||
|
||||
<property name="deprecation" value="on" />
|
||||
|
||||
<path id="basic.classpath">
|
||||
<pathelement location="${source.home}" />
|
||||
<pathelement location="${lib}/junit-3.8.1.jar" />
|
||||
</path>
|
||||
|
||||
<path id="log4j12.classpath">
|
||||
<path refid="basic.classpath" />
|
||||
<pathelement location="${javac.dest.12}" />
|
||||
<pathelement location="${lib}/log4j-1.2.14.jar" />
|
||||
</path>
|
||||
|
||||
<path id="log4j13.classpath">
|
||||
<path refid="basic.classpath" />
|
||||
<pathelement location="${javac.dest.13}" />
|
||||
<pathelement location="${lib}/log4j-1.3alpha-8.jar" />
|
||||
</path>
|
||||
|
||||
<path id="los.classpath">
|
||||
<path refid="basic.classpath" />
|
||||
<pathelement location="${lib}/log4j-over-slf4j-${slf4jversion}.jar" />
|
||||
<pathelement location="${lib}/logback-classic-${lbversion}.jar" />
|
||||
<pathelement location="${lib}/logback-core-${lbversion}.jar" />
|
||||
<pathelement location="${lib}/slf4j-api-${slf4jversion}.jar" />
|
||||
</path>
|
||||
|
||||
<!-- ================================================================= -->
|
||||
<!-- Default target -->
|
||||
<!-- ================================================================= -->
|
||||
<target name="usage">
|
||||
<echo>
|
||||
These are some of the targets supported by this ANT build scpript:
|
||||
|
||||
all - run all available tests
|
||||
refresh - copy required jar files to the lib directory
|
||||
</echo>
|
||||
</target>
|
||||
|
||||
<delete>
|
||||
<fileset dir="." includes="**/*.bak"/>
|
||||
</delete>
|
||||
|
||||
<target name="refresh">
|
||||
<delete>
|
||||
<fileset dir="lib">
|
||||
<include name="logback-*.jar"/>
|
||||
<include name="log4j-bridge-*.jar"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<copy file="../../slf4j-api/target/slf4j-api-${slf4jversion}.jar" todir="lib/"/>
|
||||
<copy file="../target/log4j-over-slf4j-${slf4jversion}.jar" todir="lib/"/>
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${javac.dest.12}" />
|
||||
<mkdir dir="${javac.dest.13}" />
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete>
|
||||
<fileset dir="${javac.dest.12}" includes="**" />
|
||||
<fileset dir="${javac.dest.13}" includes="**" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="build_log4j12" depends="init">
|
||||
<javac srcdir="${source.home}"
|
||||
destdir="${javac.dest.12}"
|
||||
includes="**/Log4j12Calls.java"
|
||||
deprecation="${deprecation}" debug="on">
|
||||
<classpath refid="log4j12.classpath" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="build_log4j13" depends="init">
|
||||
<javac srcdir="${source.home}"
|
||||
destdir="${javac.dest.13}"
|
||||
includes="**/Log4j13Calls.java" deprecation="${deprecation}" debug="on">
|
||||
<classpath refid="log4j13.classpath" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="build_loggerTest" depends="init">
|
||||
<javac srcdir="${source.home}"
|
||||
destdir="${javac.dest.12}"
|
||||
includes="**/LoggerTest.java"
|
||||
deprecation="${deprecation}" debug="on">
|
||||
<classpath refid="los.classpath" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- ================================================================= -->
|
||||
<!-- Run tests -->
|
||||
<!-- ================================================================= -->
|
||||
<target name="all" depends="test12, test13, loggerTest" />
|
||||
|
||||
|
||||
<target name="loggerTest" depends="build_loggerTest">
|
||||
<junit printsummary="yes" fork="yes" haltonfailure="yes">
|
||||
<classpath refid="los.classpath" />
|
||||
<classpath location="${javac.dest.12}" />
|
||||
<formatter type="plain" usefile="false" />
|
||||
<test name="test.LoggerTest" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="test12" depends="build_log4j12">
|
||||
<junit printsummary="yes" fork="yes" haltonfailure="yes">
|
||||
<classpath refid="los.classpath" />
|
||||
<classpath location="${javac.dest.12}" />
|
||||
<formatter type="plain" usefile="false" />
|
||||
<test name="test.Log4j12Calls" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="test13" depends="build_log4j13">
|
||||
<junit printsummary="yes" fork="yes" haltonfailure="yes">
|
||||
<classpath refid="los.classpath" />
|
||||
<classpath location="${javac.dest.13}" />
|
||||
<formatter type="plain" usefile="false" />
|
||||
<test name="test.Log4j13Calls" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
This directory is used to test the module against various log4j calls.
|
||||
Two test cases simulate the typical calls that one can find in an application
|
||||
that uses either log4j 1.2.x, or log4j 1.3.x.
|
||||
|
||||
In the same directory is a build.xml file that uses ant to
|
||||
compile the test cases with the corresponding log4j version,
|
||||
and to runs these tests without log4j in the classpath but with
|
||||
logback jars instead.
|
||||
|
||||
To run the tests, one must have ant installed. Issuing the following command,
|
||||
once in the compatibility directory will launch the tests:
|
||||
|
||||
ant all
|
||||
|
||||
To obtain more information about the use of the log4j-over-slf4j module,
|
||||
please visit http://www..slf4j.org/log4j-over-slf4j.html
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
package test;
|
||||
|
||||
public class DummyObject {
|
||||
|
||||
public String toString() {
|
||||
return "dummy";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* Logback: the reliable, generic, fast and flexible logging framework.
|
||||
*
|
||||
* Copyright (C) 1999-2006, QOS.ch
|
||||
*
|
||||
* This library is free software, you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation.
|
||||
*/
|
||||
package test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
/**
|
||||
*
|
||||
* A test case that issues the typical calls
|
||||
* that an application using log4j 1.2 would do.
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
* @author Sébastien Pennec
|
||||
*/
|
||||
public class Log4j12Calls extends TestCase {
|
||||
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
|
||||
|
||||
public void testLog() {
|
||||
MDC.put("key", "value1");
|
||||
|
||||
logger.trace("Trace level can be noisy");
|
||||
logger.debug("Entering application");
|
||||
logger.info("Violets are blue");
|
||||
logger.warn("Here is a warning");
|
||||
logger.error("Exiting application", new Exception("just testing"));
|
||||
|
||||
MDC.remove("key");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/**
|
||||
* Logback: the reliable, generic, fast and flexible logging framework.
|
||||
*
|
||||
* Copyright (C) 1999-2006, QOS.ch
|
||||
*
|
||||
* This library is free software, you can redistribute it and/or modify it under
|
||||
* the terms of the GNU Lesser General Public License as published by the Free
|
||||
* Software Foundation.
|
||||
*/
|
||||
|
||||
package test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
/**
|
||||
*
|
||||
* A test case that issues the typical calls
|
||||
* that an application using log4j 1.3 would do.
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
* @author Sébastien Pennec
|
||||
*/
|
||||
|
||||
public class Log4j13Calls extends TestCase {
|
||||
public static final Logger logger = Logger.getLogger(Log4j12Calls.class);
|
||||
|
||||
public void testLog() {
|
||||
MDC.put("key", "value1");
|
||||
|
||||
logger.trace("Trace level can be noisy");
|
||||
logger.debug("Entering application");
|
||||
logger.info("Violets are blue");
|
||||
logger.warn("Here is a warning");
|
||||
logger.info("The answer is {}.", new Integer(42));
|
||||
logger.info("Number: {} and another one: {}.", new Integer(42), new Integer(24));
|
||||
|
||||
logger.error("Exiting application", new Exception("just testing"));
|
||||
|
||||
MDC.remove("key");
|
||||
|
||||
MDC.clear();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
package test;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||
import ch.qos.logback.core.read.ListAppender;
|
||||
import org.apache.log4j.Level;
|
||||
|
||||
/**
|
||||
* A class that tests the invocation of the org.apache.log4j.Logger class that
|
||||
* belongs to the log4j-bridge package
|
||||
*
|
||||
* @author Sébastien Pennec
|
||||
* @author Ceki Gülcü
|
||||
*/
|
||||
|
||||
public class LoggerTest extends TestCase {
|
||||
|
||||
LoggerContext context;
|
||||
ListAppender<LoggingEvent> appender;
|
||||
ch.qos.logback.classic.Logger logbackLogger;
|
||||
org.apache.log4j.Logger log4jLogger;
|
||||
|
||||
public void setUp() throws Exception {
|
||||
context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
context.shutdownAndReset();
|
||||
appender = new ListAppender<LoggingEvent>();
|
||||
appender.setContext(context);
|
||||
appender.setName("listAppender");
|
||||
appender.start();
|
||||
ch.qos.logback.classic.Logger lbLogger = context
|
||||
.getLogger(LoggerContext.ROOT_NAME);
|
||||
lbLogger.addAppender(appender);
|
||||
|
||||
log4jLogger = org.apache.log4j.Logger.getLogger(LoggerTest.class);
|
||||
logbackLogger = context.getLogger(LoggerTest.class);
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
appender.stop();
|
||||
context.stop();
|
||||
appender = null;
|
||||
context = null;
|
||||
logbackLogger = null;
|
||||
log4jLogger = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testLogWithObjectMessages() {
|
||||
LoggingEvent event;
|
||||
|
||||
log4jLogger.debug("test");
|
||||
event = appender.list.get(0);
|
||||
assertEquals("test", event.getMessage());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.debug(null);
|
||||
event = appender.list.get(0);
|
||||
assertEquals(null, event.getMessage());
|
||||
appender.list.clear();
|
||||
|
||||
DummyObject dummy = new DummyObject();
|
||||
log4jLogger.debug(dummy);
|
||||
event = appender.list.get(0);
|
||||
assertEquals(dummy.toString(), event.getMessage());
|
||||
appender.list.clear();
|
||||
}
|
||||
|
||||
public void testIsEnabledAPI() {
|
||||
assertFalse(log4jLogger.isTraceEnabled());
|
||||
assertTrue(log4jLogger.isDebugEnabled());
|
||||
assertTrue(log4jLogger.isInfoEnabled());
|
||||
assertTrue(log4jLogger.isWarnEnabled());
|
||||
assertTrue(log4jLogger.isErrorEnabled());
|
||||
}
|
||||
|
||||
public void testPrintAPI() {
|
||||
Exception e = new Exception("just testing");
|
||||
|
||||
log4jLogger.trace(null);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.debug(null);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.debug("debug message");
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.info(null);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.info("info message");
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.warn(null);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.warn("warn message");
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.error(null);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.error("error message");
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.debug(null, e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.debug("debug message", e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.info(null, e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.info("info message", e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.warn(null, e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.warn("warn message", e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.error(null, e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
log4jLogger.error("error message", e);
|
||||
assertEquals(1, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
}
|
||||
|
||||
public void testLogAPI() {
|
||||
log4jLogger.log("x", Level.TRACE, "x", null);
|
||||
assertEquals(0, appender.list.size());
|
||||
|
||||
log4jLogger.log("x", Level.DEBUG, "x", null);
|
||||
log4jLogger.log("x", Level.INFO, "x", null);
|
||||
log4jLogger.log("x", Level.WARN, "x", null);
|
||||
log4jLogger.log("x", Level.ERROR, "x", null);
|
||||
log4jLogger.log("x", Level.FATAL, "x", null);
|
||||
|
||||
assertEquals(5, appender.list.size());
|
||||
appender.list.clear();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
|
|
@ -20,11 +21,15 @@
|
|||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache Software Licenses</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<name>Apache-2.0</name>
|
||||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<properties>
|
||||
<module-name>log4j</module-name>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
@ -36,5 +41,21 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<_exportcontents>org.apache.log4j*;version=${reload4j.version};-noimport:=true</_exportcontents>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public interface Appender {
|
|||
/**
|
||||
* Release any resources allocated within the appender such as file
|
||||
* handles, network connections, etc.
|
||||
* <p/>
|
||||
*
|
||||
* <p>It is a programming error to append to a closed appender.
|
||||
*
|
||||
* @since 0.8.4
|
||||
|
|
@ -114,12 +114,12 @@ public interface Appender {
|
|||
* Configurators call this method to determine if the appender
|
||||
* requires a layout. If this method returns <code>true</code>,
|
||||
* meaning that layout is required, then the configurator will
|
||||
* configure an layout using the configuration information at its
|
||||
* configure a layout using the configuration information at its
|
||||
* disposal. If this method returns <code>false</code>, meaning that
|
||||
* a layout is not required, then layout configuration will be
|
||||
* skipped even if there is available layout configuration
|
||||
* information at the disposal of the configurator.
|
||||
* <p/>
|
||||
*
|
||||
* <p>In the rather exceptional case, where the appender
|
||||
* implementation admits a layout but can also work without it, then
|
||||
* the appender should return <code>true</code>.
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import java.util.Enumeration;
|
|||
* This class is a minimal implementation of the original
|
||||
* <code>org.apache.log4j.Category</code> class (as found in log4j 1.2) by
|
||||
* delegation of all calls to a {@link org.slf4j.Logger} instance.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Log4j's <code>trace</code>, <code>debug()</code>, <code>info()</code>,
|
||||
|
|
@ -45,12 +45,12 @@ public class Category {
|
|||
|
||||
private static final String CATEGORY_FQCN = Category.class.getName();
|
||||
|
||||
private String name;
|
||||
private final String name;
|
||||
|
||||
protected org.slf4j.Logger slf4jLogger;
|
||||
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
|
||||
|
||||
private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
|
||||
private static final Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
|
||||
|
||||
Category(String name) {
|
||||
this.name = name;
|
||||
|
|
@ -125,6 +125,7 @@ public class Category {
|
|||
|
||||
/**
|
||||
* @deprecated Please use {@link #getLevel} instead.
|
||||
* @return a Level
|
||||
*/
|
||||
final public Level getPriority() {
|
||||
return null;
|
||||
|
|
@ -132,6 +133,9 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#isDebugEnabled} method in SLF4J
|
||||
*
|
||||
* @return true if this logger is enabled for the level DEBUG
|
||||
*
|
||||
*/
|
||||
public boolean isDebugEnabled() {
|
||||
return slf4jLogger.isDebugEnabled();
|
||||
|
|
@ -139,6 +143,8 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#isInfoEnabled} method in SLF4J
|
||||
*
|
||||
* @return true if this logger is enabled for the level INFO
|
||||
*/
|
||||
public boolean isInfoEnabled() {
|
||||
return slf4jLogger.isInfoEnabled();
|
||||
|
|
@ -146,6 +152,8 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#isWarnEnabled} method in SLF4J
|
||||
*
|
||||
* @return true if this logger is enabled for the level WARN
|
||||
*/
|
||||
public boolean isWarnEnabled() {
|
||||
return slf4jLogger.isWarnEnabled();
|
||||
|
|
@ -153,6 +161,8 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#isErrorEnabled} method in SLF4J
|
||||
*
|
||||
* @return true if this logger is enabled for the level ERROR
|
||||
*/
|
||||
public boolean isErrorEnabled() {
|
||||
return slf4jLogger.isErrorEnabled();
|
||||
|
|
@ -160,13 +170,11 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Determines whether the priority passed as parameter is enabled in the
|
||||
* underlying SLF4J logger. Each log4j priority is mapped directly to its
|
||||
* SLF4J equivalent, except for FATAL which is mapped as ERROR.
|
||||
* underlying SLF4J logger. Each log4j priority is mapped directly to its SLF4J
|
||||
* equivalent, except for FATAL which is mapped as ERROR.
|
||||
*
|
||||
* @param p
|
||||
* the priority to check against
|
||||
* @return true if this logger is enabled for the given level, false
|
||||
* otherwise.
|
||||
* @param p the priority to check against
|
||||
* @return true if this logger is enabled for the given level, false otherwise.
|
||||
*/
|
||||
public boolean isEnabledFor(Priority p) {
|
||||
switch (p.level) {
|
||||
|
|
@ -194,19 +202,19 @@ public class Category {
|
|||
} else {
|
||||
switch (level) {
|
||||
case LocationAwareLogger.TRACE_INT:
|
||||
slf4jLogger.trace(marker, m);
|
||||
slf4jLogger.trace(marker, m, (Throwable) t);
|
||||
break;
|
||||
case LocationAwareLogger.DEBUG_INT:
|
||||
slf4jLogger.debug(marker, m);
|
||||
slf4jLogger.debug(marker, m, (Throwable) t);
|
||||
break;
|
||||
case LocationAwareLogger.INFO_INT:
|
||||
slf4jLogger.info(marker, m);
|
||||
slf4jLogger.info(marker, m, (Throwable) t);
|
||||
break;
|
||||
case LocationAwareLogger.WARN_INT:
|
||||
slf4jLogger.warn(marker, m);
|
||||
slf4jLogger.warn(marker, m, (Throwable) t);
|
||||
break;
|
||||
case LocationAwareLogger.ERROR_INT:
|
||||
slf4jLogger.error(marker, m);
|
||||
slf4jLogger.error(marker, m, (Throwable) t);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -214,6 +222,8 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#debug(String)} method of SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
*/
|
||||
public void debug(Object message) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, null);
|
||||
|
|
@ -222,6 +232,9 @@ public class Category {
|
|||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#debug(String,Throwable)} method in
|
||||
* SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
* @param t a throwable to log
|
||||
*/
|
||||
public void debug(Object message, Throwable t) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.DEBUG_INT, message, t);
|
||||
|
|
@ -229,14 +242,18 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#info(String)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
*/
|
||||
public void info(Object message) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in
|
||||
* SLF4J.
|
||||
* Delegates to {@link org.slf4j.Logger#info(String,Throwable)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
* @param t a throwable to log
|
||||
*/
|
||||
public void info(Object message, Throwable t) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.INFO_INT, message, t);
|
||||
|
|
@ -244,14 +261,20 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#warn(String)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
*
|
||||
*/
|
||||
public void warn(Object message) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in
|
||||
* SLF4J.
|
||||
* Delegates to {@link org.slf4j.Logger#warn(String,Throwable)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
* @param t a throwable to log
|
||||
*
|
||||
*/
|
||||
public void warn(Object message, Throwable t) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.WARN_INT, message, t);
|
||||
|
|
@ -259,6 +282,9 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
*
|
||||
*/
|
||||
public void error(Object message) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
|
||||
|
|
@ -267,6 +293,10 @@ public class Category {
|
|||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
|
||||
* SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
* @param t a throwable to log
|
||||
*
|
||||
*/
|
||||
public void error(Object message, Throwable t) {
|
||||
differentiatedLog(null, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
|
||||
|
|
@ -274,6 +304,9 @@ public class Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#error(String)} method in SLF4J.
|
||||
*
|
||||
* @param message a message to log
|
||||
*
|
||||
*/
|
||||
public void fatal(Object message) {
|
||||
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, null);
|
||||
|
|
@ -282,6 +315,10 @@ public class Category {
|
|||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#error(String,Throwable)} method in
|
||||
* SLF4J. In addition, the call is marked with a marker named "FATAL".
|
||||
*
|
||||
* @param message a message to log
|
||||
* @param t a throwable to log
|
||||
*
|
||||
*/
|
||||
public void fatal(Object message, Throwable t) {
|
||||
differentiatedLog(FATAL_MARKER, CATEGORY_FQCN, LocationAwareLogger.ERROR_INT, message, t);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.log4j;
|
|||
/**
|
||||
* This class is a minimal implementation of the original Log4J class.
|
||||
*
|
||||
* @author Christian Trutz <christian.trutz@belaso.de>
|
||||
* @author Christian Trutz
|
||||
* */
|
||||
public class Layout {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,21 +26,21 @@ import java.io.ObjectStreamException;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
Defines the minimum set of levels recognized by the system, that is
|
||||
<code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>,
|
||||
<code>WARN</code>, <code>INFO</code>, <code>DEBUG</code> and
|
||||
<code>ALL</code>.
|
||||
|
||||
<p>The <code>Level</code> class may be subclassed to define a larger
|
||||
level set.
|
||||
|
||||
@author Ceki Gülcü
|
||||
|
||||
* Defines the minimum set of levels recognized by the system, that is
|
||||
* <code>OFF</code>, <code>FATAL</code>, <code>ERROR</code>, <code>WARN</code>,
|
||||
* <code>INFO</code>, <code>DEBUG</code> and <code>ALL</code>.
|
||||
*
|
||||
* <p>
|
||||
* The <code>Level</code> class may be subclassed to define a larger level set.
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
*
|
||||
*/
|
||||
public class Level extends Priority implements Serializable {
|
||||
|
||||
/**
|
||||
* TRACE level integer value.
|
||||
*
|
||||
* @since 1.2.12
|
||||
*/
|
||||
public static final int TRACE_INT = 5000;
|
||||
|
|
@ -49,48 +49,52 @@ public class Level extends Priority implements Serializable {
|
|||
public static final int X_TRACE_INT = DEBUG_INT - 100;
|
||||
|
||||
/**
|
||||
The <code>OFF</code> has the highest possible rank and is
|
||||
intended to turn off logging. */
|
||||
* The <code>OFF</code> has the highest possible rank and is intended to turn
|
||||
* off logging.
|
||||
*/
|
||||
final static public Level OFF = new Level(OFF_INT, "OFF", 0);
|
||||
|
||||
/**
|
||||
The <code>FATAL</code> level designates very severe error
|
||||
events that will presumably lead the application to abort.
|
||||
* The <code>FATAL</code> level designates very severe error events that will
|
||||
* presumably lead the application to abort.
|
||||
*/
|
||||
final static public Level FATAL = new Level(FATAL_INT, "FATAL", 0);
|
||||
|
||||
/**
|
||||
The <code>ERROR</code> level designates error events that
|
||||
might still allow the application to continue running. */
|
||||
* The <code>ERROR</code> level designates error events that might still allow
|
||||
* the application to continue running.
|
||||
*/
|
||||
final static public Level ERROR = new Level(ERROR_INT, "ERROR", 3);
|
||||
|
||||
/**
|
||||
The <code>WARN</code> level designates potentially harmful situations.
|
||||
*/
|
||||
* The <code>WARN</code> level designates potentially harmful situations.
|
||||
*/
|
||||
final static public Level WARN = new Level(WARN_INT, "WARN", 4);
|
||||
|
||||
/**
|
||||
The <code>INFO</code> level designates informational messages
|
||||
that highlight the progress of the application at coarse-grained
|
||||
level. */
|
||||
* The <code>INFO</code> level designates informational messages that highlight
|
||||
* the progress of the application at coarse-grained level.
|
||||
*/
|
||||
final static public Level INFO = new Level(INFO_INT, "INFO", 6);
|
||||
|
||||
/**
|
||||
The <code>DEBUG</code> Level designates fine-grained
|
||||
informational events that are most useful to debug an
|
||||
application. */
|
||||
* The <code>DEBUG</code> Level designates fine-grained informational events
|
||||
* that are most useful to debug an application.
|
||||
*/
|
||||
final static public Level DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
|
||||
|
||||
/**
|
||||
* The <code>TRACE</code> Level designates finer-grained
|
||||
* informational events than the <code>DEBUG</code level.
|
||||
* @since 1.2.12
|
||||
*/
|
||||
* The <code>TRACE</code> Level designates finer-grained informational events
|
||||
* than the <code>DEBUG</code> level.
|
||||
*
|
||||
* @since 1.2.12
|
||||
*/
|
||||
public static final Level TRACE = new Level(TRACE_INT, "TRACE", 7);
|
||||
|
||||
/**
|
||||
The <code>ALL</code> has the lowest possible rank and is intended to
|
||||
turn on all logging. */
|
||||
* The <code>ALL</code> has the lowest possible rank and is intended to turn on
|
||||
* all logging.
|
||||
*/
|
||||
final static public Level ALL = new Level(ALL_INT, "ALL", 7);
|
||||
|
||||
/**
|
||||
|
|
@ -99,33 +103,47 @@ public class Level extends Priority implements Serializable {
|
|||
static final long serialVersionUID = 3491141966387921974L;
|
||||
|
||||
/**
|
||||
Instantiate a Level object.
|
||||
* Instantiate a Level object.
|
||||
*
|
||||
* @param level a level
|
||||
* @param levelStr a level string
|
||||
* @param syslogEquivalent the Syslog equivalent
|
||||
*/
|
||||
protected Level(int level, String levelStr, int syslogEquivalent) {
|
||||
super(level, levelStr, syslogEquivalent);
|
||||
}
|
||||
|
||||
/**
|
||||
Convert the string passed as argument to a level. If the
|
||||
conversion fails, then this method returns {@link #DEBUG}.
|
||||
*/
|
||||
* Convert the string passed as argument to a level. If the conversion fails,
|
||||
* then this method returns {@link #DEBUG}.
|
||||
*
|
||||
* @param sArg a string
|
||||
* @return corresponding Level
|
||||
*
|
||||
*/
|
||||
public static Level toLevel(String sArg) {
|
||||
return (Level) toLevel(sArg, Level.DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
Convert an integer passed as argument to a level. If the
|
||||
conversion fails, then this method returns {@link #DEBUG}.
|
||||
|
||||
*/
|
||||
* Convert an integer passed as argument to a level. If the conversion fails,
|
||||
* then this method returns {@link #DEBUG}.
|
||||
*
|
||||
* @param val an int
|
||||
* @return a level
|
||||
*/
|
||||
public static Level toLevel(int val) {
|
||||
return (Level) toLevel(val, Level.DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
Convert an integer passed as argument to a level. If the
|
||||
conversion fails, then this method returns the specified default.
|
||||
*/
|
||||
* Convert an integer passed as argument to a level. If the conversion fails,
|
||||
* then this method returns the specified default.
|
||||
*
|
||||
* @param val a value
|
||||
* @param defaultLevel a defaultLevel
|
||||
* @return corresponding Level
|
||||
*/
|
||||
public static Level toLevel(int val, Level defaultLevel) {
|
||||
switch (val) {
|
||||
case ALL_INT:
|
||||
|
|
@ -150,10 +168,13 @@ public class Level extends Priority implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
Convert the string passed as argument to a level. If the
|
||||
conversion fails, then this method returns the value of
|
||||
<code>defaultLevel</code>.
|
||||
*/
|
||||
* Convert the string passed as argument to a level. If the conversion fails,
|
||||
* then this method returns the value of <code>defaultLevel</code>.
|
||||
*
|
||||
* @param sArg a string
|
||||
* @param defaultLevel a default level
|
||||
* @return corresponding level
|
||||
*/
|
||||
public static Level toLevel(String sArg, Level defaultLevel) {
|
||||
if (sArg == null)
|
||||
return defaultLevel;
|
||||
|
|
@ -181,8 +202,9 @@ public class Level extends Priority implements Serializable {
|
|||
|
||||
/**
|
||||
* Custom deserialization of Level.
|
||||
*
|
||||
* @param s serialization stream.
|
||||
* @throws IOException if IO exception.
|
||||
* @throws IOException if IO exception.
|
||||
* @throws ClassNotFoundException if class not found.
|
||||
*/
|
||||
private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
|
||||
|
|
@ -197,6 +219,7 @@ public class Level extends Priority implements Serializable {
|
|||
|
||||
/**
|
||||
* Serialize level.
|
||||
*
|
||||
* @param s serialization stream.
|
||||
* @throws IOException if exception during serialization.
|
||||
*/
|
||||
|
|
@ -208,8 +231,9 @@ public class Level extends Priority implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Resolved deserialized level to one of the stock instances.
|
||||
* May be overridden in classes derived from Level.
|
||||
* Resolved deserialized level to one of the stock instances. May be overridden
|
||||
* in classes derived from Level.
|
||||
*
|
||||
* @return resolved object.
|
||||
* @throws ObjectStreamException if exception during resolution.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
class Log4jLoggerFactory {
|
||||
|
||||
// String, Logger
|
||||
private static ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<String, Logger>();
|
||||
private static final ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<>();
|
||||
|
||||
public static Logger getLogger(String name) {
|
||||
org.apache.log4j.Logger instance = log4jLoggers.get(name);
|
||||
|
|
|
|||
|
|
@ -22,12 +22,11 @@ import java.util.Enumeration;
|
|||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* <p/>
|
||||
* <p>
|
||||
* This class is a minimal implementation of the original
|
||||
* <code>org.apache.log4j.LogManager</code> class (as found in log4j 1.2)
|
||||
* delegating all calls to SLF4J.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <p>
|
||||
* This implementation does <b>NOT</b> implement the setRepositorySelector(),
|
||||
* getLoggerRepository(), exists(), getCurrentLoggers(), shutdown() and
|
||||
* resetConfiguration() methods which do not have SLF4J equivalents.
|
||||
|
|
@ -67,7 +66,7 @@ public class LogManager {
|
|||
/**
|
||||
* This bogus implementation returns an empty enumeration.
|
||||
*
|
||||
* @return
|
||||
* @return an Enumeration of current loggers
|
||||
*/
|
||||
public static Enumeration getCurrentLoggers() {
|
||||
return new Vector().elements();
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.slf4j.spi.LocationAwareLogger;
|
|||
* This class is a minimal implementation of the original
|
||||
* <code>org.apache.log4j.Logger</code> class (as found in log4j 1.2)
|
||||
* delegating all calls to a {@link org.slf4j.Logger} instance.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
* */
|
||||
|
|
@ -52,7 +52,7 @@ public class Logger extends Category {
|
|||
/**
|
||||
* Does the obvious.
|
||||
*
|
||||
* @return
|
||||
* @return the root logger
|
||||
*/
|
||||
public static Logger getRootLogger() {
|
||||
return Log4jLoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
|
||||
|
|
@ -61,6 +61,8 @@ public class Logger extends Category {
|
|||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#isTraceEnabled}
|
||||
* method of SLF4J.
|
||||
*
|
||||
* @return whether this logger is enabled for the level TRACE
|
||||
*/
|
||||
public boolean isTraceEnabled() {
|
||||
return slf4jLogger.isTraceEnabled();
|
||||
|
|
@ -68,6 +70,9 @@ public class Logger extends Category {
|
|||
|
||||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#trace(String)} method in SLF4J.
|
||||
*
|
||||
* @param message the message to log
|
||||
*
|
||||
*/
|
||||
public void trace(Object message) {
|
||||
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
|
||||
|
|
@ -76,9 +81,12 @@ public class Logger extends Category {
|
|||
/**
|
||||
* Delegates to {@link org.slf4j.Logger#trace(String,Throwable)}
|
||||
* method in SLF4J.
|
||||
*
|
||||
* @param message the message to log
|
||||
* @param t a Throwable to log
|
||||
*/
|
||||
public void trace(Object message, Throwable t) {
|
||||
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, null);
|
||||
differentiatedLog(null, LOGGER_FQCN, LocationAwareLogger.TRACE_INT, message, t);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ public class MDC {
|
|||
* This method is not part of the Log4J public API. However it
|
||||
* has been called by other projects. This method is here temporarily
|
||||
* until projects who are depending on this method release fixes.
|
||||
*
|
||||
* @return a copy of the underlying map returned as a Hashtable
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Deprecated
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package org.apache.log4j;
|
|||
/**
|
||||
* This class is a minimal implementation of the original Log4J class.
|
||||
*
|
||||
* @author Christian Trutz <christian.trutz@belaso.de>
|
||||
* @author Christian Trutz
|
||||
* */
|
||||
public class PatternLayout extends Layout {
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ package org.apache.log4j;
|
|||
// Contributors: Kitching Simon <Simon.Kitching@OOOrange.ch>
|
||||
|
||||
/**
|
||||
<font color="#AA4444">Refrain from using this class directly, use
|
||||
the {@link Level} class instead</font>.
|
||||
<b>Refrain from using this class directly, use
|
||||
the {@link Level} class instead</b>.
|
||||
|
||||
@author Ceki Gülcü */
|
||||
public class Priority {
|
||||
|
|
@ -48,21 +48,25 @@ public class Priority {
|
|||
/**
|
||||
* @deprecated Use {@link Level#ERROR} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
final static public Priority ERROR = new Level(ERROR_INT, "ERROR", 3);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Level#WARN} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
final static public Priority WARN = new Level(WARN_INT, "WARN", 4);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Level#INFO} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
final static public Priority INFO = new Level(INFO_INT, "INFO", 6);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Level#DEBUG} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
final static public Priority DEBUG = new Level(DEBUG_INT, "DEBUG", 7);
|
||||
|
||||
/**
|
||||
|
|
@ -76,6 +80,15 @@ public class Priority {
|
|||
|
||||
/**
|
||||
Instantiate a level object.
|
||||
@param
|
||||
*/
|
||||
|
||||
/**
|
||||
* Instantiate a level object.
|
||||
*
|
||||
* @param level a level as in int
|
||||
* @param levelStr a levelStr
|
||||
* @param syslogEquivalent the syslog equivalent level integer
|
||||
*/
|
||||
protected Priority(int level, String levelStr, int syslogEquivalent) {
|
||||
this.level = level;
|
||||
|
|
@ -98,20 +111,23 @@ public class Priority {
|
|||
|
||||
/**
|
||||
Return the syslog equivalent of this priority as an integer.
|
||||
@return the Syslog Equivalent of this Priority
|
||||
*/
|
||||
public final int getSyslogEquivalent() {
|
||||
return syslogEquivalent;
|
||||
}
|
||||
|
||||
/**
|
||||
Returns <code>true</code> if this level has a higher or equal
|
||||
level than the level passed as argument, <code>false</code>
|
||||
otherwise.
|
||||
|
||||
<p>You should think twice before overriding the default
|
||||
implementation of <code>isGreaterOrEqual</code> method.
|
||||
|
||||
*/
|
||||
* Returns <code>true</code> if this level has a higher or equal
|
||||
* level than the level passed as argument, <code>false</code>
|
||||
* otherwise.
|
||||
*
|
||||
* <p>You should think twice before overriding the default
|
||||
* implementation of <code>isGreaterOrEqual</code> method.
|
||||
*
|
||||
* @param r a priority
|
||||
* @return a boolean
|
||||
*/
|
||||
public boolean isGreaterOrEqual(Priority r) {
|
||||
return level >= r.level;
|
||||
}
|
||||
|
|
@ -119,9 +135,11 @@ public class Priority {
|
|||
/**
|
||||
Return all possible priorities as an array of Level objects in
|
||||
descending order.
|
||||
|
||||
|
||||
@deprecated This method will be removed with no replacement.
|
||||
@return array of all possible priorities
|
||||
*/
|
||||
@Deprecated
|
||||
public static Priority[] getAllPossiblePriorities() {
|
||||
return new Priority[] { Priority.FATAL, Priority.ERROR, Level.WARN, Priority.INFO, Priority.DEBUG };
|
||||
}
|
||||
|
|
@ -134,7 +152,9 @@ public class Priority {
|
|||
}
|
||||
|
||||
/**
|
||||
Returns the integer representation of this level.
|
||||
* Returns the integer representation of this level.
|
||||
*
|
||||
* @return integer representation of this level
|
||||
*/
|
||||
public final int toInt() {
|
||||
return level;
|
||||
|
|
@ -142,29 +162,46 @@ public class Priority {
|
|||
|
||||
/**
|
||||
* @deprecated Please use the {@link Level#toLevel(String)} method instead.
|
||||
*
|
||||
* @param sArg a string to convert to a Priority
|
||||
* @return the corresponding Priority
|
||||
*/
|
||||
@Deprecated
|
||||
public static Priority toPriority(String sArg) {
|
||||
return Level.toLevel(sArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use the {@link Level#toLevel(int)} method instead.
|
||||
*
|
||||
* @param val an integer to convert to a Priority
|
||||
* @return the corresponding Priority
|
||||
*/
|
||||
@Deprecated
|
||||
public static Priority toPriority(int val) {
|
||||
return toPriority(val, Priority.DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use the {@link Level#toLevel(int, Level)} method instead.
|
||||
*/
|
||||
*
|
||||
* @param val an integer value
|
||||
* @param defaultPriority a default priority value
|
||||
* @return corresponding Priority value
|
||||
*/
|
||||
@Deprecated
|
||||
public static Priority toPriority(int val, Priority defaultPriority) {
|
||||
return Level.toLevel(val, (Level) defaultPriority);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Please use the {@link Level#toLevel(String, Level)} method instead.
|
||||
* @param sArg string value
|
||||
* @param defaultPriority a default Priority
|
||||
* @return a Priority
|
||||
*/
|
||||
@Deprecated
|
||||
public static Priority toPriority(String sArg, Priority defaultPriority) {
|
||||
return Level.toLevel(sArg, (Level) defaultPriority);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.apache.log4j.spi.Configurator;
|
|||
import org.apache.log4j.spi.LoggerRepository;
|
||||
|
||||
/**
|
||||
* An nop implementation of PropertyConfigurator.
|
||||
* A no-op implementation of PropertyConfigurator.
|
||||
*/
|
||||
public class PropertyConfigurator implements Configurator {
|
||||
public static void configure(Properties properties) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import java.io.IOException;
|
|||
/**
|
||||
* This class is a minimal implementation of the original Log4J class.
|
||||
*
|
||||
* @author Christian Trutz <christian.trutz@belaso.de>
|
||||
* @author Christian Trutz
|
||||
* */
|
||||
public class RollingFileAppender {
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ package org.apache.log4j.helpers;
|
|||
<b>log4j.configDebug</b> variable.
|
||||
|
||||
<p>All log4j internal debug calls go to <code>System.out</code>
|
||||
where as internal error messages are sent to
|
||||
whereas internal error messages are sent to
|
||||
<code>System.err</code>. All internal messages are prepended with
|
||||
the string "log4j: ".
|
||||
|
||||
|
|
@ -37,20 +37,20 @@ public class LogLog {
|
|||
/**
|
||||
Defining this value makes log4j print log4j-internal debug
|
||||
statements to <code>System.out</code>.
|
||||
|
||||
|
||||
<p> The value of this string is <b>log4j.debug</b>.
|
||||
|
||||
<p>Note that the search for all option names is case sensitive. */
|
||||
|
||||
<p>Note that the search for all option names is case-sensitive. */
|
||||
public static final String DEBUG_KEY = "log4j.debug";
|
||||
|
||||
/**
|
||||
Defining this value makes log4j components print log4j-internal
|
||||
debug statements to <code>System.out</code>.
|
||||
|
||||
|
||||
<p> The value of this string is <b>log4j.configDebug</b>.
|
||||
|
||||
<p>Note that the search for all option names is case sensitive.
|
||||
|
||||
|
||||
<p>Note that the search for all option names is case-sensitive.
|
||||
|
||||
@deprecated Use {@link #DEBUG_KEY} instead.
|
||||
*/
|
||||
public static final String CONFIG_DEBUG_KEY = "log4j.configDebug";
|
||||
|
|
@ -127,7 +127,7 @@ public class LogLog {
|
|||
/**
|
||||
In quite mode no LogLog generates strictly no output, not even
|
||||
for errors.
|
||||
|
||||
|
||||
@param quietMode A true for not
|
||||
*/
|
||||
public static void setQuietMode(boolean quietMode) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.apache.log4j.spi;
|
||||
|
||||
import org.apache.log4j.spi.LoggerRepository;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
|
|
@ -41,10 +40,10 @@ public interface Configurator {
|
|||
|
||||
/**
|
||||
Interpret a resource pointed by a URL and set up log4j accordingly.
|
||||
|
||||
|
||||
The configuration is done relative to the <code>hierarchy</code>
|
||||
parameter.
|
||||
|
||||
|
||||
@param url The URL to parse
|
||||
@param repository The hierarchy to operation upon.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
|
||||
Implement this interface to create new instances of Logger or
|
||||
a sub-class of Logger.
|
||||
a subclass of Logger.
|
||||
|
||||
<p>See <code>examples/subclass/MyLogger.java</code> for an example.
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.Enumeration;
|
|||
* <code>Loggers</code>. The relation between loggers in a repository
|
||||
* depends on the repository but typically loggers are arranged in a
|
||||
* named hierarchy.
|
||||
* <p/>
|
||||
*
|
||||
* <p>In addition to the creational methods, a
|
||||
* <code>LoggerRepository</code> can be queried for existing loggers,
|
||||
* can act as a point of registry for events related to loggers.
|
||||
|
|
@ -37,6 +37,8 @@ public interface LoggerRepository {
|
|||
|
||||
/**
|
||||
* Add a {@link HierarchyEventListener} event to the repository.
|
||||
*
|
||||
* @param listener a listener
|
||||
*/
|
||||
public void addHierarchyEventListener(HierarchyEventListener listener);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
module log4j {
|
||||
requires org.slf4j;
|
||||
requires java.xml;
|
||||
exports org.apache.log4j;
|
||||
exports org.apache.log4j.helpers;
|
||||
exports org.apache.log4j.spi;
|
||||
exports org.apache.log4j.xml;
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
Implementation-Title: log4j-over-slf4j
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: log4j.over.slf4j
|
||||
Bundle-Name: log4j-over-slf4j
|
||||
Bundle-Vendor: SLF4J.ORG
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Automatic-Module-Name: org.apache.log4j
|
||||
Export-Package: org.apache.log4j;version=${log4j.version},
|
||||
org.apache.log4j.helpers;version=${log4j.version},
|
||||
org.apache.log4j.spi;version=${log4j.version},
|
||||
org.apache.log4j.xml;version=${log4j.version}
|
||||
Import-Package: org.slf4j;version=${slf4j.api.minimum.compatible.version},
|
||||
org.slf4j.helpers;version=${slf4j.api.minimum.compatible.version},
|
||||
org.slf4j.spi;version=${slf4j.api.minimum.compatible.version}
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.apache.log4j;
|
||||
package org.apache.log4j.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
|
@ -30,6 +30,8 @@ import org.junit.After;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.apache.log4j.NDC;
|
||||
|
||||
/**
|
||||
* @author Ceki Gülcü
|
||||
*/
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.apache.log4j;
|
||||
package org.apache.log4j.test;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ import java.util.logging.LogRecord;
|
|||
|
||||
public class ListHandler extends Handler {
|
||||
|
||||
List<LogRecord> list = new ArrayList<LogRecord>();
|
||||
List<LogRecord> list = new ArrayList<>();
|
||||
|
||||
public void close() throws SecurityException {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2004-2007 QOS.ch
|
||||
Copyright (c) 2004-2022 QOS.ch Sarl (Switzerland)
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../parent/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>osgi-over-slf4j</artifactId>
|
||||
|
|
@ -37,10 +38,27 @@
|
|||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>org.slf4j.osgi-over-slf4j</Bundle-SymbolicName>
|
||||
<Bundle-Activator>org.slf4j.osgi.logservice.impl.Activator</Bundle-Activator>
|
||||
<Bundle-Category>osgi</Bundle-Category>
|
||||
<_exportcontents combine.self="override" />
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
Implementation-Title: osgi-over-slf4j
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: org.slf4j.osgi-over-slf4j
|
||||
Bundle-Name: OSGi LogService implemented over SLF4J
|
||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||
Bundle-Activator: org.slf4j.osgi.logservice.impl.Activator
|
||||
Bundle-Category: osgi
|
||||
Import-Package: org.osgi.framework;version="[1.5,2)",org.osgi.service.log;version="[1.3,2)",org.slf4j;version=${parsedVersion.osgiVersion}
|
||||
|
|
@ -0,0 +1,397 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-bom</artifactId>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>SLF4J Parent POM</name>
|
||||
<description>SLF4J project parent pom.xml file</description>
|
||||
|
||||
|
||||
<organization>
|
||||
<name>QOS.ch</name>
|
||||
<url>http://www.qos.ch</url>
|
||||
</organization>
|
||||
<inceptionYear>2005</inceptionYear>
|
||||
|
||||
|
||||
<properties>
|
||||
<!-- yyyy-MM-dd'T'HH:mm:ss'Z' -->
|
||||
<project.build.outputTimestamp>2026-05-12T18:37:04Z</project.build.outputTimestamp>
|
||||
<latest.1.version>1.7.36</latest.1.version>
|
||||
<!-- java.util.ServiceLoader requires Java 6 -->
|
||||
<jdk.version>8</jdk.version>
|
||||
<maven.compiler.source>${jdk.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${jdk.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- used in integration testing -->
|
||||
<cal10n.version>0.8.1</cal10n.version>
|
||||
<reload4j.version>1.2.22</reload4j.version>
|
||||
<logback.version>1.2.10</logback.version>
|
||||
<jcl.version>1.2</jcl.version>
|
||||
<junit.version>4.13.1</junit.version>
|
||||
<maven-site-plugin.version>3.7.1</maven-site-plugin.version>
|
||||
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
|
||||
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
|
||||
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
|
||||
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
|
||||
<maven-deploy-plugin.version>3.0.0-M1</maven-deploy-plugin.version>
|
||||
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
|
||||
<maven-jxr-plugin.version>3.1.1</maven-jxr-plugin.version>
|
||||
<maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>${reload4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.cal10n</groupId>
|
||||
<artifactId>cal10n-api</artifactId>
|
||||
<version>${cal10n.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>2.10</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
|
||||
<resource>
|
||||
<directory>..</directory>
|
||||
<targetPath>META-INF</targetPath>
|
||||
<includes>
|
||||
<include>LICENSE.txt</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.14</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java16</artifactId>
|
||||
<version>1.0</version>
|
||||
</signature>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>${maven-deploy-plugin.version}</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<executions>
|
||||
|
||||
<execution>
|
||||
<id>default-compile</id>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<source>${jdk.version}</source>
|
||||
<target>${jdk.version}</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
<execution>
|
||||
<id>module-compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<release>9</release>
|
||||
<compileSourceRoots>
|
||||
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
|
||||
</compileSourceRoots>
|
||||
<multiReleaseOutput>true</multiReleaseOutput>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
|
||||
</executions>
|
||||
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>${maven-jar-plugin.version}</version>
|
||||
<executions>
|
||||
<!-- Repeated in slf4j-api/pom.xml -->
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
<skipIfEmpty>true</skipIfEmpty>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>${maven-bundle-plugin.version}</version>
|
||||
<configuration>
|
||||
<supportIncrementalBuild>true</supportIncrementalBuild>
|
||||
<!-- populated by the plugin itself -->
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${replacestring;${project.artifactId};-;.}</Bundle-SymbolicName>
|
||||
<Bundle-Vendor>SLF4J.ORG</Bundle-Vendor>
|
||||
<_snapshot/>
|
||||
<_exportcontents>!META-INF.versions.9,*;-noimport:=true</_exportcontents>
|
||||
<Bundle-Description>${project.description}</Bundle-Description>
|
||||
<Bundle-DocURL>${project.url}</Bundle-DocURL>
|
||||
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
|
||||
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
<Implementation-Title>${project.artifactId}</Implementation-Title>
|
||||
<Multi-Release>true</Multi-Release>
|
||||
<_removeheaders>Private-Package,Bundle-SCM, Bundle-Developers, Include-Resource</_removeheaders>
|
||||
</instructions>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-manifest</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>manifest</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<forkCount>1</forkCount>
|
||||
<reuseForks>false</reuseForks>
|
||||
<reportFormat>plain</reportFormat>
|
||||
<trimStackTrace>false</trimStackTrace>
|
||||
<excludes>
|
||||
<exclude>**/AllTest.java</exclude>
|
||||
<exclude>**/PackageTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>${maven-site-plugin.version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>skipTests</id>
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>javadocjar</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${maven-javadoc-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<failOnError>false</failOnError>
|
||||
<sourceFileExcludes>
|
||||
<sourceFileExclude>**/module-info.java</sourceFileExclude>
|
||||
</sourceFileExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>license</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
<configuration>
|
||||
<header>src/main/licenseHeader.txt</header>
|
||||
<quiet>false</quiet>
|
||||
<failIfMissing>true</failIfMissing>
|
||||
<aggregate>true</aggregate>
|
||||
<includes>
|
||||
<include>src/**/*.java</include>
|
||||
</includes>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<useDefaultMapping>true</useDefaultMapping>
|
||||
<properties>
|
||||
<year>1999</year>
|
||||
</properties>
|
||||
<headerDefinitions>
|
||||
<headerDefinition>src/main/javadocHeaders.xml</headerDefinition>
|
||||
</headerDefinitions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<pluginRepositories>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
|
||||
|
||||
<profile>
|
||||
<id>generate-osgi-service-loader-mediator-entries</id>
|
||||
<activation>
|
||||
<file>
|
||||
<exists>src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider</exists>
|
||||
</file>
|
||||
</activation>
|
||||
<build>
|
||||
<!-- Add the OSGi Service Loader Mediator Specification Manifest entries for each module that has a SLF4JServiceProvider Service-Loader file.-->
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Provide-Capability><![CDATA[
|
||||
osgi.service;objectClass:List<String>="org.slf4j.spi.SLF4JServiceProvider";type=${slf4j.provider.type};effective:=active,
|
||||
osgi.serviceloader;osgi.serviceloader="org.slf4j.spi.SLF4JServiceProvider";register:="${slf4j.provider.implementation}";type=${slf4j.provider.type}
|
||||
]]></Provide-Capability>
|
||||
<Require-Capability><![CDATA[
|
||||
osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0.0)(!(version>=2.0.0)))"
|
||||
]]></Require-Capability>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<!--
|
||||
<profile>
|
||||
<id>travis</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.TRAVIS</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-toolchains-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>toolchain</id>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
-->
|
||||
</profiles>
|
||||
|
||||
|
||||
</project>
|
||||
495
pom.xml
495
pom.xml
|
|
@ -5,88 +5,53 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
|
||||
<artifactId>slf4j-bom</artifactId>
|
||||
<version>2.0.19-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>SLF4J</name>
|
||||
<description>Top SLF4J project pom.xml file</description>
|
||||
|
||||
<url>http://www.slf4j.org</url>
|
||||
|
||||
<organization>
|
||||
<name>QOS.ch</name>
|
||||
<url>http://www.qos.ch</url>
|
||||
</organization>
|
||||
<inceptionYear>2005</inceptionYear>
|
||||
<name>SLF4J BOM</name>
|
||||
<description>SLF4J project BOM</description>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>MIT License</name>
|
||||
<url>http://www.opensource.org/licenses/mit-license.php</url>
|
||||
<name>MIT</name>
|
||||
<url>https://opensource.org/license/mit</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
|
||||
<scm>
|
||||
<url>https://github.com/qos-ch/slf4j</url>
|
||||
<connection>git@github.com:qos-ch/slf4j.git</connection>
|
||||
</scm>
|
||||
<connection>scm:git:https://github.com/qos-ch/slf4j.git</connection>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<required.jdk.version>1.5</required.jdk.version>
|
||||
<maven.compiler.source>${required.jdk.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${required.jdk.version}</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- used in integration testing -->
|
||||
<slf4j.api.minimum.compatible.version>1.6.0</slf4j.api.minimum.compatible.version>
|
||||
<cal10n.version>0.8.1</cal10n.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
<reload4j.version>1.2.18.0</reload4j.version>
|
||||
<logback.version>1.0.13</logback.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<maven-site-plugin.version>3.3</maven-site-plugin.version>
|
||||
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
|
||||
<javadoc.plugin.version>3.1.0</javadoc.plugin.version>
|
||||
<doclint>none</doclint>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>ceki</id>
|
||||
<name>Ceki Gulcu</name>
|
||||
<email>ceki@qos.ch</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<!-- Inspired by Improving the Maven Bill of Materials (BOM) Pattern -->
|
||||
<!-- https://www.garretwilson.com/blog/2023/06/14/improve-maven-bom-pattern -->
|
||||
<modules>
|
||||
<module>parent</module>
|
||||
<module>slf4j-api</module>
|
||||
<module>slf4j-simple</module>
|
||||
<module>slf4j-nop</module>
|
||||
<module>slf4j-jdk14</module>
|
||||
<module>slf4j-jdk-platform-logging</module>
|
||||
<module>slf4j-log4j12</module>
|
||||
<module>slf4j-reload4j</module>
|
||||
<module>slf4j-jcl</module>
|
||||
<module>slf4j-android</module>
|
||||
<module>slf4j-reload4j</module>
|
||||
<module>slf4j-ext</module>
|
||||
<module>jcl-over-slf4j</module>
|
||||
<module>log4j-over-slf4j</module>
|
||||
<module>jul-to-slf4j</module>
|
||||
<module>osgi-over-slf4j</module>
|
||||
<module>integration</module>
|
||||
<module>slf4j-site</module>
|
||||
<module>slf4j-migrator</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
|
@ -99,300 +64,181 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-nop</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>${reload4j.version}</version>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-jdk-platform-logging</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.cal10n</groupId>
|
||||
<artifactId>cal10n-api</artifactId>
|
||||
<version>${cal10n.version}</version>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-reload4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-ext</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jul-to-slf4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>osgi-over-slf4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<distributionManagement>
|
||||
|
||||
<repository>
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
|
||||
</distributionManagement>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<id>ceki</id>
|
||||
<name>Ceki Gulcu</name>
|
||||
<email>ceki@qos.ch</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.wagon</groupId>
|
||||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>2.0</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.14</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java15</artifactId>
|
||||
<version>1.0</version>
|
||||
</signature>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<configuration>
|
||||
<source>${required.jdk.version}</source>
|
||||
<target>${required.jdk.version}</target>
|
||||
<verbose>true</verbose>
|
||||
<skippedModules>
|
||||
slf4j-jdk-platform-logging,slf4j-migrator,osgi-over-slf4j
|
||||
</skippedModules>
|
||||
<detectLinks>true</detectLinks>
|
||||
<doctitle>SLF4J project modules ${project.version}</doctitle>
|
||||
<windowtitle>SLF4J javadoc</windowtitle>
|
||||
<bottom><![CDATA[Copyright © 2005-{currentYear} QOS.CH Sarl. All rights reserved]]></bottom>
|
||||
<linksource>true</linksource>
|
||||
<additionalOptions>
|
||||
<additionalOption>-Xdoclint:none</additionalOption>
|
||||
</additionalOptions>
|
||||
<groups>
|
||||
<group>
|
||||
<title>SLF4J API packages</title>
|
||||
<packages>org.slf4j:org.slf4j.spi:org.slf4j.event:org.slf4j.helpers</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>slf4j-simple package</title>
|
||||
<packages>org.slf4j.simple</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>slf4j-nop package</title>
|
||||
<packages>org.slf4j.nop</packages>
|
||||
</group>
|
||||
|
||||
|
||||
<group>
|
||||
<title>slf4j-jdk14 package</title>
|
||||
<packages>org.slf4j.jul</packages>
|
||||
</group>
|
||||
|
||||
|
||||
<group>
|
||||
<title>slf4j-reload4j package</title>
|
||||
<packages>org.slf4j.reload4j</packages>
|
||||
</group>
|
||||
|
||||
|
||||
<group>
|
||||
<title>SLF4J extensions</title>
|
||||
<packages>
|
||||
org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
|
||||
</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>Jakarta Commons Logging packages</title>
|
||||
<packages>org.apache.commons.*</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>java.util.logging (JUL) to SLF4J bridge</title>
|
||||
<packages>org.slf4j.bridge</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>log4j-over-slf4j redirection</title>
|
||||
<packages>org.apache.log4j:org.apache.log4j.*</packages>
|
||||
</group>
|
||||
</groups>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<groupId>org.sonatype.central</groupId>
|
||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||
<version>${central-publishing-maven-plugin.version}</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
|
||||
<Bundle-Description>${project.description}</Bundle-Description>
|
||||
<X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK>
|
||||
<X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK>
|
||||
<Implementation-Version>${project.version}</Implementation-Version>
|
||||
</manifestEntries>
|
||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
|
||||
</archive>
|
||||
<skipIfEmpty>true</skipIfEmpty>
|
||||
<publishingServerId>central</publishingServerId>
|
||||
<excludeArtifacts>integration</excludeArtifacts>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19.1</version>
|
||||
<configuration>
|
||||
<forkCount>2C</forkCount>
|
||||
<reuseForks>true</reuseForks>
|
||||
<reportFormat>plain</reportFormat>
|
||||
<trimStackTrace>false</trimStackTrace>
|
||||
<excludes>
|
||||
<exclude>**/AllTest.java</exclude>
|
||||
<exclude>**/PackageTest.java</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/source.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>slf4j-${project.version}</finalName>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<outputDirectory>target/site/dist/</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- as suggested in http://jira.qos.ch/browse/SLF4J-143 -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>parse-version</id>
|
||||
<goals>
|
||||
<goal>parse-version</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- ====== site plugin ===== -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>${maven-site-plugin.version}</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<aggregate>true</aggregate>
|
||||
<javadocDir>target/site/apidocs/</javadocDir>
|
||||
<linkJavadoc>true</linkJavadoc>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${javadoc.plugin.version}</version>
|
||||
<configuration>
|
||||
<linksource>true</linksource>
|
||||
<doclint>none</doclint>
|
||||
|
||||
<!--<aggregate>true</aggregate>-->
|
||||
<excludePackageNames>org.slf4j.migrator:org.slf4j.migrator.*</excludePackageNames>
|
||||
<links>
|
||||
<link>
|
||||
http://java.sun.com/j2se/1.5.0/docs/api
|
||||
</link>
|
||||
</links>
|
||||
<groups>
|
||||
<group>
|
||||
<title>SLF4J packages</title>
|
||||
<packages>org.slf4j:org.slf4j.*</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>SLF4J extensions</title>
|
||||
<packages>
|
||||
org.slf4j.cal10n:org.slf4j.profiler:org.slf4j.ext:org.slf4j.instrumentation:org.slf4j.agent
|
||||
</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>Jakarta Commons Logging packages</title>
|
||||
<packages>org.apache.commons.*</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>java.util.logging (JUL) to SLF4J bridge</title>
|
||||
<packages>org.slf4j.bridge</packages>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<title>Apache log4j</title>
|
||||
<packages>org.apache.log4j:org.apache.log4j.*</packages>
|
||||
</group>
|
||||
</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</reportPlugins>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>skipTests</id>
|
||||
<properties>
|
||||
<maven.test.skip>true</maven.test.skip>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>javadocjar</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${javadoc.plugin.version}</version>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>license</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
<configuration>
|
||||
<header>src/main/licenseHeader.txt</header>
|
||||
<quiet>false</quiet>
|
||||
<failIfMissing>true</failIfMissing>
|
||||
<aggregate>true</aggregate>
|
||||
<includes>
|
||||
<include>src/**/*.java</include>
|
||||
</includes>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<useDefaultMapping>true</useDefaultMapping>
|
||||
<properties>
|
||||
<year>1999</year>
|
||||
</properties>
|
||||
<headerDefinitions>
|
||||
<headerDefinition>src/main/javadocHeaders.xml</headerDefinition>
|
||||
</headerDefinitions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>mc-release</id>
|
||||
<name>Local Maven repository of releases</name>
|
||||
<url>http://mc-repo.googlecode.com/svn/maven2/releases</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>sign-artifacts</id>
|
||||
|
|
@ -415,25 +261,6 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<pluginRepositories>
|
||||
</pluginRepositories>
|
||||
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>qos_ch</id>
|
||||
<url>scp://te.qos.ch/var/www/www.slf4j.org/htdocs/</url>
|
||||
</site>
|
||||
|
||||
<repository>
|
||||
<!--<id>pixie</id>-->
|
||||
<!--<url>scp://pixie.qos.ch/var/mvnrepo/</url>-->
|
||||
<id>sonatype-nexus-staging</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
|
||||
</distributionManagement>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
63
release.sh
63
release.sh
|
|
@ -1,10 +1,18 @@
|
|||
|
||||
# Javadoc
|
||||
|
||||
#JDK8 - mvn site:site
|
||||
#rscpSLF4J apidocs/
|
||||
|
||||
# JDK 11+
|
||||
# adding the following
|
||||
#mvn -Ddoclint=none -Dadditionalparam=-Xdoclint:none javadoc:aggregate
|
||||
|
||||
|
||||
#mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${VERSION_NUMBER}
|
||||
|
||||
MVN='/java/maven-3.5.2//bin/mvn'
|
||||
|
||||
PASS=$1
|
||||
echo $PASS
|
||||
|
||||
function checkExit(){
|
||||
if test "$?" != "0"; then
|
||||
echo Command $1 exited with abnormal status
|
||||
|
|
@ -13,37 +21,42 @@ function checkExit(){
|
|||
fi
|
||||
}
|
||||
|
||||
function echoThenRun () { # echo and then run the command
|
||||
function echoRunAndCheck () { # echo and then run the command
|
||||
echo $1
|
||||
$1
|
||||
ret=$?
|
||||
echo $ret
|
||||
return $ret
|
||||
if test "$ret" != "0";
|
||||
then
|
||||
echo Failed command: $1
|
||||
exit 1;
|
||||
else echo Successful run: $1
|
||||
fi
|
||||
}
|
||||
|
||||
$MVN clean
|
||||
checkExit "mvn clean"
|
||||
echoRunAndCheck "$MVN clean"
|
||||
|
||||
echoRunAndCheck "$MVN install"
|
||||
|
||||
#echoRunAndCheck "$MVN site:site"
|
||||
|
||||
#echoRunAndCheck "$MVN javadoc:aggregate"
|
||||
|
||||
#echoRunAndCheck "$MVN jxr:aggregate"
|
||||
|
||||
|
||||
$MVN install
|
||||
checkExit "mvn install"
|
||||
if [ ! -z "$PASS" ]
|
||||
then
|
||||
# WARNING deploying without cleaning may leave stale MANIFEST files
|
||||
export GPG_TTY=$(tty)
|
||||
echoRunAndCheck "$MVN deploy -P javadocjar,sign-artifacts"
|
||||
fi
|
||||
|
||||
|
||||
$MVN site:site
|
||||
checkExit "mvn site:ste"
|
||||
git tag -m "tagging" -a v_${VERSION_NUMBER}
|
||||
git push --tags
|
||||
|
||||
#Update release version and add next version on jira
|
||||
|
||||
|
||||
$MVN assembly:single
|
||||
checkExit "mvn assembly:single"
|
||||
|
||||
|
||||
$MVN deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=$PASS
|
||||
checkExit "mvn deploy -P javadocjar,sign-artifacts -Dgpg.passphrase=xxx"
|
||||
|
||||
#$MVN site:deploy -N # with Java 8!!!
|
||||
#checkExit "mvn site:deploy -N"
|
||||
|
||||
#git tag -m "tagging" -a v_${VERSION_NUMBER}
|
||||
#git push --tags
|
||||
|
||||
#release version and add next version on jira
|
||||
echo Full Success
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
bin/
|
||||
gen/
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.slf4j"
|
||||
android:versionCode="176"
|
||||
android:versionName="1.7.6">
|
||||
<uses-sdk android:minSdkVersion="3" />
|
||||
</manifest>
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-parent</artifactId>
|
||||
<version>1.7.33</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>slf4j-android</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>SLF4J Android Binding</name>
|
||||
<description>SLF4J Android Binding</description>
|
||||
<url>http://www.slf4j.org</url>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<version>1.5_r4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
android.library=true
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-3
|
||||
|
|
@ -1,552 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2013 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.impl;
|
||||
|
||||
import android.util.Log;
|
||||
import org.slf4j.helpers.FormattingTuple;
|
||||
import org.slf4j.helpers.MarkerIgnoringBase;
|
||||
import org.slf4j.helpers.MessageFormatter;
|
||||
|
||||
/**
|
||||
* <p>A simple implementation that delegates all log requests to the Google Android
|
||||
* logging facilities. Note that this logger does not support {@link org.slf4j.Marker}.
|
||||
* Methods taking marker data as parameter simply invoke the eponymous method
|
||||
* without the Marker argument, discarding any marker data in the process.</p>
|
||||
*
|
||||
* <p>The logging levels specified for SLF4J can be almost directly mapped to
|
||||
* the levels that exist in the Google Android platform. The following table
|
||||
* shows the mapping implemented by this logger.</p>
|
||||
*
|
||||
* <table border="1">
|
||||
* <tr><th><b>SLF4J<b></th><th><b>Android</b></th></tr>
|
||||
* <tr><td>TRACE</td><td>{@link android.util.Log#VERBOSE}</td></tr>
|
||||
* <tr><td>DEBUG</td><td>{@link android.util.Log#DEBUG}</td></tr>
|
||||
* <tr><td>INFO</td><td>{@link android.util.Log#INFO}</td></tr>
|
||||
* <tr><td>WARN</td><td>{@link android.util.Log#WARN}</td></tr>
|
||||
* <tr><td>ERROR</td><td>{@link android.util.Log#ERROR}</td></tr>
|
||||
* </table>
|
||||
*
|
||||
* <p>Use loggers as usual:
|
||||
* <ul>
|
||||
* <li>
|
||||
* Declare a logger<br/>
|
||||
* <code>private static final Logger logger = LoggerFactory.getLogger(MyClass.class);</code>
|
||||
* </li>
|
||||
* <li>
|
||||
* Invoke logging methods, e.g.,<br/>
|
||||
* <code>logger.debug("Some log message. Details: {}", someObject);</code><br/>
|
||||
* <code>logger.debug("Some log message with varargs. Details: {}, {}, {}", someObject1, someObject2, someObject3);</code>
|
||||
* </li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* <p>Logger instances created using the LoggerFactory are named either according to the name
|
||||
* or the fully qualified class name of the class given as a parameter.
|
||||
* Each logger name will be used as the log message tag on the Android platform.
|
||||
* However, tag names cannot be longer than 23 characters so if logger name exceeds this limit then
|
||||
* it will be truncated by the LoggerFactory. The following examples illustrate this.
|
||||
* <table border="1">
|
||||
* <tr><th><b>Original Name<b></th><th><b>Truncated Name</b></th></tr>
|
||||
* <tr><td>org.example.myproject.mypackage.MyClass</td><td>o*.e*.m*.m*.MyClass</td></tr>
|
||||
* <tr><td>o.e.myproject.mypackage.MyClass</td><td>o.e.m*.m*.MyClass</td></tr>
|
||||
* <tr><td>org.example.ThisNameIsWayTooLongAndWillBeTruncated</td><td>*LongAndWillBeTruncated</td></tr>
|
||||
* <tr><td>ThisNameIsWayTooLongAndWillBeTruncated</td><td>*LongAndWillBeTruncated</td></tr>
|
||||
* </table>
|
||||
* </p>
|
||||
*
|
||||
* @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com>
|
||||
*/
|
||||
class AndroidLoggerAdapter extends MarkerIgnoringBase {
|
||||
private static final long serialVersionUID = -1227274521521287937L;
|
||||
|
||||
/**
|
||||
* Package access allows only {@link AndroidLoggerFactory} to instantiate
|
||||
* SimpleLogger instances.
|
||||
*/
|
||||
AndroidLoggerAdapter(String tag) {
|
||||
this.name = tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this logger instance enabled for the VERBOSE level?
|
||||
*
|
||||
* @return True if this Logger is enabled for level VERBOSE, false otherwise.
|
||||
*/
|
||||
public boolean isTraceEnabled() {
|
||||
return isLoggable(Log.VERBOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message object at level VERBOSE.
|
||||
*
|
||||
* @param msg
|
||||
* - the message object to be logged
|
||||
*/
|
||||
public void trace(String msg) {
|
||||
log(Log.VERBOSE, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level VERBOSE according to the specified format and
|
||||
* argument.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for level VERBOSE.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg
|
||||
* the argument
|
||||
*/
|
||||
public void trace(String format, Object arg) {
|
||||
formatAndLog(Log.VERBOSE, format, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level VERBOSE according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the VERBOSE level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg1
|
||||
* the first argument
|
||||
* @param arg2
|
||||
* the second argument
|
||||
*/
|
||||
public void trace(String format, Object arg1, Object arg2) {
|
||||
formatAndLog(Log.VERBOSE, format, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level VERBOSE according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the VERBOSE level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param argArray
|
||||
* an array of arguments
|
||||
*/
|
||||
public void trace(String format, Object... argArray) {
|
||||
formatAndLog(Log.VERBOSE, format, argArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception (throwable) at level VERBOSE with an accompanying message.
|
||||
*
|
||||
* @param msg
|
||||
* the message accompanying the exception
|
||||
* @param t
|
||||
* the exception (throwable) to log
|
||||
*/
|
||||
public void trace(String msg, Throwable t) {
|
||||
log(Log.VERBOSE, msg, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this logger instance enabled for the DEBUG level?
|
||||
*
|
||||
* @return True if this Logger is enabled for level DEBUG, false otherwise.
|
||||
*/
|
||||
public boolean isDebugEnabled() {
|
||||
return isLoggable(Log.DEBUG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message object at level DEBUG.
|
||||
*
|
||||
* @param msg
|
||||
* - the message object to be logged
|
||||
*/
|
||||
public void debug(String msg) {
|
||||
log(Log.DEBUG, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level DEBUG according to the specified format and argument.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for level DEBUG.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg
|
||||
* the argument
|
||||
*/
|
||||
public void debug(String format, Object arg) {
|
||||
formatAndLog(Log.DEBUG, format, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level DEBUG according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the DEBUG level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg1
|
||||
* the first argument
|
||||
* @param arg2
|
||||
* the second argument
|
||||
*/
|
||||
public void debug(String format, Object arg1, Object arg2) {
|
||||
formatAndLog(Log.DEBUG, format, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level DEBUG according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the DEBUG level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param argArray
|
||||
* an array of arguments
|
||||
*/
|
||||
public void debug(String format, Object... argArray) {
|
||||
formatAndLog(Log.DEBUG, format, argArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception (throwable) at level DEBUG with an accompanying message.
|
||||
*
|
||||
* @param msg
|
||||
* the message accompanying the exception
|
||||
* @param t
|
||||
* the exception (throwable) to log
|
||||
*/
|
||||
public void debug(String msg, Throwable t) {
|
||||
log(Log.VERBOSE, msg, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this logger instance enabled for the INFO level?
|
||||
*
|
||||
* @return True if this Logger is enabled for the INFO level, false otherwise.
|
||||
*/
|
||||
public boolean isInfoEnabled() {
|
||||
return isLoggable(Log.INFO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message object at the INFO level.
|
||||
*
|
||||
* @param msg
|
||||
* - the message object to be logged
|
||||
*/
|
||||
public void info(String msg) {
|
||||
log(Log.INFO, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level INFO according to the specified format and argument.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the INFO level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg
|
||||
* the argument
|
||||
*/
|
||||
public void info(String format, Object arg) {
|
||||
formatAndLog(Log.INFO, format, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at the INFO level according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the INFO level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg1
|
||||
* the first argument
|
||||
* @param arg2
|
||||
* the second argument
|
||||
*/
|
||||
public void info(String format, Object arg1, Object arg2) {
|
||||
formatAndLog(Log.INFO, format, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level INFO according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the INFO level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param argArray
|
||||
* an array of arguments
|
||||
*/
|
||||
public void info(String format, Object... argArray) {
|
||||
formatAndLog(Log.INFO, format, argArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception (throwable) at the INFO level with an accompanying
|
||||
* message.
|
||||
*
|
||||
* @param msg
|
||||
* the message accompanying the exception
|
||||
* @param t
|
||||
* the exception (throwable) to log
|
||||
*/
|
||||
public void info(String msg, Throwable t) {
|
||||
log(Log.INFO, msg, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this logger instance enabled for the WARN level?
|
||||
*
|
||||
* @return True if this Logger is enabled for the WARN level, false
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean isWarnEnabled() {
|
||||
return isLoggable(Log.WARN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message object at the WARN level.
|
||||
*
|
||||
* @param msg
|
||||
* - the message object to be logged
|
||||
*/
|
||||
public void warn(String msg) {
|
||||
log(Log.WARN, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at the WARN level according to the specified format and
|
||||
* argument.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the WARN level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg
|
||||
* the argument
|
||||
*/
|
||||
public void warn(String format, Object arg) {
|
||||
formatAndLog(Log.WARN, format, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at the WARN level according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the WARN level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg1
|
||||
* the first argument
|
||||
* @param arg2
|
||||
* the second argument
|
||||
*/
|
||||
public void warn(String format, Object arg1, Object arg2) {
|
||||
formatAndLog(Log.WARN, format, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level WARN according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the WARN level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param argArray
|
||||
* an array of arguments
|
||||
*/
|
||||
public void warn(String format, Object... argArray) {
|
||||
formatAndLog(Log.WARN, format, argArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception (throwable) at the WARN level with an accompanying
|
||||
* message.
|
||||
*
|
||||
* @param msg
|
||||
* the message accompanying the exception
|
||||
* @param t
|
||||
* the exception (throwable) to log
|
||||
*/
|
||||
public void warn(String msg, Throwable t) {
|
||||
log(Log.WARN, msg, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this logger instance enabled for level ERROR?
|
||||
*
|
||||
* @return True if this Logger is enabled for level ERROR, false otherwise.
|
||||
*/
|
||||
public boolean isErrorEnabled() {
|
||||
return isLoggable(Log.ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message object at the ERROR level.
|
||||
*
|
||||
* @param msg
|
||||
* - the message object to be logged
|
||||
*/
|
||||
public void error(String msg) {
|
||||
log(Log.ERROR, msg, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at the ERROR level according to the specified format and
|
||||
* argument.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the ERROR level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg
|
||||
* the argument
|
||||
*/
|
||||
public void error(String format, Object arg) {
|
||||
formatAndLog(Log.ERROR, format, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at the ERROR level according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the ERROR level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param arg1
|
||||
* the first argument
|
||||
* @param arg2
|
||||
* the second argument
|
||||
*/
|
||||
public void error(String format, Object arg1, Object arg2) {
|
||||
formatAndLog(Log.ERROR, format, arg1, arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message at level ERROR according to the specified format and
|
||||
* arguments.
|
||||
*
|
||||
* <p>
|
||||
* This form avoids superfluous object creation when the logger is disabled
|
||||
* for the ERROR level.
|
||||
* </p>
|
||||
*
|
||||
* @param format
|
||||
* the format string
|
||||
* @param argArray
|
||||
* an array of arguments
|
||||
*/
|
||||
public void error(String format, Object... argArray) {
|
||||
formatAndLog(Log.ERROR, format, argArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an exception (throwable) at the ERROR level with an accompanying
|
||||
* message.
|
||||
*
|
||||
* @param msg
|
||||
* the message accompanying the exception
|
||||
* @param t
|
||||
* the exception (throwable) to log
|
||||
*/
|
||||
public void error(String msg, Throwable t) {
|
||||
log(Log.ERROR, msg, t);
|
||||
}
|
||||
|
||||
private void formatAndLog(int priority, String format, Object... argArray) {
|
||||
if (isLoggable(priority)) {
|
||||
FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
|
||||
logInternal(priority, ft.getMessage(), ft.getThrowable());
|
||||
}
|
||||
}
|
||||
|
||||
private void log(int priority, String message, Throwable throwable) {
|
||||
if (isLoggable(priority)) {
|
||||
logInternal(priority, message, throwable);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLoggable(int priority) {
|
||||
return Log.isLoggable(name, priority);
|
||||
}
|
||||
|
||||
private void logInternal(int priority, String message, Throwable throwable) {
|
||||
if (throwable != null) {
|
||||
message += '\n' + Log.getStackTraceString(throwable);
|
||||
}
|
||||
Log.println(priority, name, message);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2013 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.impl;
|
||||
|
||||
import org.slf4j.ILoggerFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
/**
|
||||
* AndroidLoggerFactory is an implementation of {@link ILoggerFactory} returning
|
||||
* the appropriately named {@link AndroidLoggerFactory} instance.
|
||||
*
|
||||
* @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com>
|
||||
*/
|
||||
class AndroidLoggerFactory implements ILoggerFactory {
|
||||
static final String ANONYMOUS_TAG = "null";
|
||||
static final int TAG_MAX_LENGTH = 23;
|
||||
|
||||
private final ConcurrentMap<String, Logger> loggerMap = new ConcurrentHashMap<String, Logger>();
|
||||
|
||||
/**
|
||||
* Return an appropriate {@link AndroidLoggerAdapter} instance by name.
|
||||
*/
|
||||
public Logger getLogger(String name) {
|
||||
String tag = loggerNameToTag(name);
|
||||
Logger logger = loggerMap.get(tag);
|
||||
if (logger == null) {
|
||||
Logger newInstance = new AndroidLoggerAdapter(tag);
|
||||
Logger oldInstance = loggerMap.putIfAbsent(tag, newInstance);
|
||||
logger = oldInstance == null ? newInstance : oldInstance;
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tag names cannot be longer than {@value #TAG_MAX_LENGTH} characters on Android platform.
|
||||
*
|
||||
* Returns the short logger tag (up to {@value #TAG_MAX_LENGTH} characters) for the given logger name.
|
||||
* Traditionally loggers are named by fully-qualified Java classes; this
|
||||
* method attempts to return a concise identifying part of such names.
|
||||
*
|
||||
* See also:
|
||||
* android/system/core/include/cutils/property.h
|
||||
* android/frameworks/base/core/jni/android_util_Log.cpp
|
||||
* dalvik.system.DalvikLogging
|
||||
*
|
||||
*/
|
||||
static String loggerNameToTag(String loggerName) {
|
||||
// Anonymous logger
|
||||
if (loggerName == null) {
|
||||
return ANONYMOUS_TAG;
|
||||
}
|
||||
|
||||
int length = loggerName.length();
|
||||
if (length <= TAG_MAX_LENGTH) {
|
||||
return loggerName;
|
||||
}
|
||||
|
||||
int tagLength = 0;
|
||||
int lastTokenIndex = 0;
|
||||
int lastPeriodIndex;
|
||||
StringBuilder tagName = new StringBuilder(TAG_MAX_LENGTH + 3);
|
||||
while ((lastPeriodIndex = loggerName.indexOf('.', lastTokenIndex)) != -1) {
|
||||
tagName.append(loggerName.charAt(lastTokenIndex));
|
||||
// token of one character appended as is otherwise truncate it to one character
|
||||
int tokenLength = lastPeriodIndex - lastTokenIndex;
|
||||
if (tokenLength > 1) {
|
||||
tagName.append('*');
|
||||
}
|
||||
tagName.append('.');
|
||||
lastTokenIndex = lastPeriodIndex + 1;
|
||||
|
||||
// check if name is already too long
|
||||
tagLength = tagName.length();
|
||||
if (tagLength > TAG_MAX_LENGTH) {
|
||||
return getSimpleName(loggerName);
|
||||
}
|
||||
}
|
||||
|
||||
// Either we had no useful dot location at all
|
||||
// or last token would exceed TAG_MAX_LENGTH
|
||||
int tokenLength = length - lastTokenIndex;
|
||||
if (tagLength == 0 || (tagLength + tokenLength) > TAG_MAX_LENGTH) {
|
||||
return getSimpleName(loggerName);
|
||||
}
|
||||
|
||||
// last token (usually class name) appended as is
|
||||
tagName.append(loggerName, lastTokenIndex, length);
|
||||
return tagName.toString();
|
||||
}
|
||||
|
||||
private static String getSimpleName(String loggerName) {
|
||||
// Take leading part and append '*' to indicate that it was truncated
|
||||
int length = loggerName.length();
|
||||
int lastPeriodIndex = loggerName.lastIndexOf('.');
|
||||
return lastPeriodIndex != -1 && length - (lastPeriodIndex + 1) <= TAG_MAX_LENGTH ? loggerName.substring(lastPeriodIndex + 1) : '*' + loggerName
|
||||
.substring(length - TAG_MAX_LENGTH + 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2013 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.impl;
|
||||
|
||||
import org.slf4j.ILoggerFactory;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.spi.LoggerFactoryBinder;
|
||||
|
||||
/**
|
||||
* The binding of {@link LoggerFactory} class with an actual instance of
|
||||
* {@link ILoggerFactory} is performed using information returned by this class.
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
* @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com>
|
||||
*/
|
||||
public class StaticLoggerBinder implements LoggerFactoryBinder {
|
||||
|
||||
/**
|
||||
* The unique instance of this class.
|
||||
*/
|
||||
private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
|
||||
|
||||
/**
|
||||
* Return the singleton of this class.
|
||||
*
|
||||
* @return the StaticLoggerBinder singleton
|
||||
*/
|
||||
public static StaticLoggerBinder getSingleton() {
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
/**
|
||||
* Declare the version of the SLF4J API this implementation is compiled against.
|
||||
* The value of this field is modified with each major release.
|
||||
*/
|
||||
// to avoid constant folding by the compiler, this field must *not* be final
|
||||
public static String REQUESTED_API_VERSION = "1.6.99"; // !final
|
||||
|
||||
private static final String loggerFactoryClassStr = AndroidLoggerFactory.class.getName();
|
||||
|
||||
/**
|
||||
* The ILoggerFactory instance returned by the {@link #getLoggerFactory} method
|
||||
* should always be the same object
|
||||
*/
|
||||
private final ILoggerFactory loggerFactory;
|
||||
|
||||
private StaticLoggerBinder() {
|
||||
loggerFactory = new AndroidLoggerFactory();
|
||||
}
|
||||
|
||||
public ILoggerFactory getLoggerFactory() {
|
||||
return loggerFactory;
|
||||
}
|
||||
|
||||
public String getLoggerFactoryClassStr() {
|
||||
return loggerFactoryClassStr;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2004-2013 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
package org.slf4j.impl;
|
||||
|
||||
import org.slf4j.helpers.NOPMDCAdapter;
|
||||
import org.slf4j.spi.MDCAdapter;
|
||||
|
||||
/**
|
||||
* This implementation is bound to {@link NOPMDCAdapter}.
|
||||
*
|
||||
* @author Ceki Gülcü
|
||||
* @author Andrey Korzhevskiy <a.korzhevskiy@gmail.com>
|
||||
*/
|
||||
public class StaticMDCBinder {
|
||||
|
||||
/**
|
||||
* The unique instance of this class.
|
||||
*/
|
||||
public static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
|
||||
|
||||
private StaticMDCBinder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the singleton of this class.
|
||||
*
|
||||
* @return the StaticMDCBinder singleton
|
||||
* @since 1.7.14
|
||||
*/
|
||||
public static final StaticMDCBinder getSingleton() {
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
/**
|
||||
* Currently this method always returns an instance of
|
||||
* {@link NOPMDCAdapter}.
|
||||
*/
|
||||
public MDCAdapter getMDCA() {
|
||||
return new NOPMDCAdapter();
|
||||
}
|
||||
|
||||
public String getMDCAdapterClassStr() {
|
||||
return NOPMDCAdapter.class.getName();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue