1
2
3
4
5
6 package pt.digitalis.dif.utils.logging;
7
8 import pt.digitalis.dif.ioc.DIFIoCRegistry;
9 import pt.digitalis.utils.config.IConfigurations;
10 import pt.digitalis.utils.config.annotations.ConfigDefault;
11 import pt.digitalis.utils.config.annotations.ConfigID;
12 import pt.digitalis.utils.config.annotations.ConfigIgnore;
13 import pt.digitalis.utils.config.annotations.ConfigSectionID;
14
15
16
17
18
19
20
21 @ConfigID("dif2")
22 @ConfigSectionID("Logging")
23 public class LoggingConfiguration {
24
25
26 static private LoggingConfiguration instance = null;
27
28
29
30
31
32
33 @ConfigIgnore
34 static public LoggingConfiguration getInstance()
35 {
36 if (instance == null)
37 try
38 {
39 instance = DIFIoCRegistry.getRegistry().getImplementation(IConfigurations.class)
40 .readConfiguration(LoggingConfiguration.class);
41 }
42 catch (Exception e)
43 {
44 instance = null;
45 }
46
47 return instance;
48 }
49
50
51 private Boolean debugModel;
52
53
54 private String errorLogEmailAddress;
55
56
57 private String errorLogEmailBody;
58
59
60 private String errorLogEmailSubject;
61
62
63
64
65
66
67 @ConfigDefault("false")
68 public Boolean getDebugModel()
69 {
70 return debugModel;
71 }
72
73
74
75
76
77
78 @ConfigDefault("")
79 public String getErrorLogEmailAddress()
80 {
81 return errorLogEmailAddress;
82 }
83
84
85
86
87
88
89 @ConfigDefault("An error occurred in application ${applicationName}. You can see the details authentication as administrator and see \"Error Log Viewer\" service.")
90 public String getErrorLogEmailBody()
91 {
92 return errorLogEmailBody;
93 }
94
95
96
97
98
99
100 @ConfigDefault("Error Log service")
101 public String getErrorLogEmailSubject()
102 {
103 return errorLogEmailSubject;
104 }
105
106
107
108
109
110
111
112 public void setDebugModel(Boolean debugModel)
113 {
114 this.debugModel = debugModel;
115 }
116
117
118
119
120
121
122
123 public void setErrorLogEmailAddress(String errorLogEmailAddress)
124 {
125 this.errorLogEmailAddress = errorLogEmailAddress;
126 }
127
128
129
130
131
132
133
134 public void setErrorLogEmailBody(String errorLogEmailBody)
135 {
136 this.errorLogEmailBody = errorLogEmailBody;
137 }
138
139
140
141
142
143
144
145 public void setErrorLogEmailSubject(String errorLogEmailSubject)
146 {
147 this.errorLogEmailSubject = errorLogEmailSubject;
148 }
149
150 }