質問編集履歴
1
Spring Bootのlogの出し方
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,19 +6,9 @@
|
|
6
6
|
|
7
7
|
_catalinaに出力する(logger).jarが分からない、という状況です。
|
8
8
|
|
9
|
+
というか、Spring Bootは「標準出力」「指定ファイル出力」に、log出力が固定されている様で、そこを切り離して、Tomcat lib のlog4j-1.2.17.jarを見に行く様にしないと、だめな様な気がして来ました。
|
9
|
-
|
10
|
+
これは、むちゃくちゃ敷居が高いですよね?
|
10
|
-
ソースは
|
11
|
-
import org.apache.commons.logging.Log;
|
12
|
-
import org.apache.commons.logging.LogFactory;
|
13
|
-
public class Classxxx extends org.apache.click.Page {
|
14
|
-
private Log log = LogFactory.getLog(this.getClass());
|
15
|
-
...
|
16
11
|
|
17
|
-
Tomcat libには
|
18
|
-
log4j-1.2.17.jar
|
19
|
-
log4j.properties
|
20
|
-
を入れています。
|
21
|
-
|
22
12
|
現在の状態は
|
23
13
|
<application.properties>
|
24
14
|
logging.file=C:/SpringBoot_log/myapplication.log
|
@@ -30,7 +20,7 @@
|
|
30
20
|
import org.slf4j.LoggerFactory;
|
31
21
|
@Controller
|
32
22
|
public class HeloController {
|
33
|
-
|
23
|
+
protected static Logger log = LoggerFactory.getLogger( HeloController.class );
|
34
24
|
|
35
25
|
で、
|
36
26
|
1. STS→実行→Spring Boot アプリケーション
|
@@ -39,4 +29,17 @@
|
|
39
29
|
|
40
30
|
Windows7
|
41
31
|
STS 3.8,2
|
42
|
-
Spring 1.4.2
|
32
|
+
Spring 1.4.2
|
33
|
+
|
34
|
+
Apache clickでは
|
35
|
+
ソースは
|
36
|
+
import org.apache.commons.logging.Log;
|
37
|
+
import org.apache.commons.logging.LogFactory;
|
38
|
+
public class Classxxx extends org.apache.click.Page {
|
39
|
+
private Log log = LogFactory.getLog(this.getClass());
|
40
|
+
...
|
41
|
+
|
42
|
+
Tomcat libには
|
43
|
+
log4j-1.2.17.jar
|
44
|
+
log4j.properties
|
45
|
+
を入れています。
|