Commit fc2b23f354c453d62df07dc21709b6d59d019ab0
1 parent
e277212d
Exists in
master
FWK-202: Injeção de java.util.logging.Logger
Task-Url: https://demoiselle.atlassian.net/browse/FWK-202
Showing
2 changed files
with
10 additions
and
12 deletions
Show diff stats
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ConnectionProducer.java
@@ -43,6 +43,7 @@ import java.util.Collections; | @@ -43,6 +43,7 @@ import java.util.Collections; | ||
43 | import java.util.HashMap; | 43 | import java.util.HashMap; |
44 | import java.util.Map; | 44 | import java.util.Map; |
45 | import java.util.Set; | 45 | import java.util.Set; |
46 | +import java.util.logging.Logger; | ||
46 | 47 | ||
47 | import javax.annotation.PostConstruct; | 48 | import javax.annotation.PostConstruct; |
48 | import javax.annotation.PreDestroy; | 49 | import javax.annotation.PreDestroy; |
@@ -52,8 +53,6 @@ import javax.enterprise.inject.Produces; | @@ -52,8 +53,6 @@ import javax.enterprise.inject.Produces; | ||
52 | import javax.enterprise.inject.spi.InjectionPoint; | 53 | import javax.enterprise.inject.spi.InjectionPoint; |
53 | import javax.inject.Inject; | 54 | import javax.inject.Inject; |
54 | 55 | ||
55 | -import org.slf4j.Logger; | ||
56 | - | ||
57 | import br.gov.frameworkdemoiselle.DemoiselleException; | 56 | import br.gov.frameworkdemoiselle.DemoiselleException; |
58 | import br.gov.frameworkdemoiselle.annotation.Name; | 57 | import br.gov.frameworkdemoiselle.annotation.Name; |
59 | import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; | 58 | import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; |
@@ -81,7 +80,7 @@ public class ConnectionProducer implements Serializable { | @@ -81,7 +80,7 @@ public class ConnectionProducer implements Serializable { | ||
81 | 80 | ||
82 | private Logger getLogger() { | 81 | private Logger getLogger() { |
83 | if (logger == null) { | 82 | if (logger == null) { |
84 | - logger = Beans.getReference(Logger.class, new NameQualifier(DataSourceProducer.class.getName())); | 83 | + logger = Beans.getReference(Logger.class, new NameQualifier("br.gov.frameworkdemoiselle.util")); |
85 | } | 84 | } |
86 | 85 | ||
87 | return logger; | 86 | return logger; |
@@ -148,7 +147,7 @@ public class ConnectionProducer implements Serializable { | @@ -148,7 +147,7 @@ public class ConnectionProducer implements Serializable { | ||
148 | try { | 147 | try { |
149 | connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); | 148 | connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); |
150 | } catch (SQLException cause) { | 149 | } catch (SQLException cause) { |
151 | - getLogger().debug(getBundle().getString("set-autocommit-failed")); | 150 | + getLogger().warning(getBundle().getString("set-autocommit-failed")); |
152 | } | 151 | } |
153 | } | 152 | } |
154 | 153 | ||
@@ -157,7 +156,7 @@ public class ConnectionProducer implements Serializable { | @@ -157,7 +156,7 @@ public class ConnectionProducer implements Serializable { | ||
157 | connection.setAutoCommit(false); | 156 | connection.setAutoCommit(false); |
158 | 157 | ||
159 | } catch (SQLException cause) { | 158 | } catch (SQLException cause) { |
160 | - getLogger().debug(getBundle().getString("set-autocommit-failed")); | 159 | + getLogger().warning(getBundle().getString("set-autocommit-failed")); |
161 | } | 160 | } |
162 | } | 161 | } |
163 | 162 | ||
@@ -165,7 +164,7 @@ public class ConnectionProducer implements Serializable { | @@ -165,7 +164,7 @@ public class ConnectionProducer implements Serializable { | ||
165 | String result = config.getDefaultDataSourceName(); | 164 | String result = config.getDefaultDataSourceName(); |
166 | 165 | ||
167 | if (result != null) { | 166 | if (result != null) { |
168 | - getLogger().debug(getBundle().getString("getting-default-datasource-name-from-properties", result)); | 167 | + getLogger().fine(getBundle().getString("getting-default-datasource-name-from-properties", result)); |
169 | } | 168 | } |
170 | 169 | ||
171 | return result; | 170 | return result; |
@@ -194,7 +193,7 @@ public class ConnectionProducer implements Serializable { | @@ -194,7 +193,7 @@ public class ConnectionProducer implements Serializable { | ||
194 | 193 | ||
195 | try { | 194 | try { |
196 | if (connection.isClosed()) { | 195 | if (connection.isClosed()) { |
197 | - getLogger().warn(getBundle().getString("connection-has-already-been-closed", key)); | 196 | + getLogger().warning(getBundle().getString("connection-has-already-been-closed", key)); |
198 | 197 | ||
199 | } else { | 198 | } else { |
200 | connection.close(); | 199 | connection.close(); |
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/DataSourceProducer.java
@@ -42,6 +42,7 @@ import java.util.HashMap; | @@ -42,6 +42,7 @@ import java.util.HashMap; | ||
42 | import java.util.HashSet; | 42 | import java.util.HashSet; |
43 | import java.util.Map; | 43 | import java.util.Map; |
44 | import java.util.Set; | 44 | import java.util.Set; |
45 | +import java.util.logging.Logger; | ||
45 | 46 | ||
46 | import javax.annotation.PostConstruct; | 47 | import javax.annotation.PostConstruct; |
47 | import javax.annotation.PreDestroy; | 48 | import javax.annotation.PreDestroy; |
@@ -51,8 +52,6 @@ import javax.naming.InitialContext; | @@ -51,8 +52,6 @@ import javax.naming.InitialContext; | ||
51 | import javax.naming.NamingException; | 52 | import javax.naming.NamingException; |
52 | import javax.sql.DataSource; | 53 | import javax.sql.DataSource; |
53 | 54 | ||
54 | -import org.slf4j.Logger; | ||
55 | - | ||
56 | import br.gov.frameworkdemoiselle.DemoiselleException; | 55 | import br.gov.frameworkdemoiselle.DemoiselleException; |
57 | import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; | 56 | import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig; |
58 | import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy; | 57 | import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy; |
@@ -79,7 +78,7 @@ public class DataSourceProducer implements Serializable { | @@ -79,7 +78,7 @@ public class DataSourceProducer implements Serializable { | ||
79 | 78 | ||
80 | private Logger getLogger() { | 79 | private Logger getLogger() { |
81 | if (logger == null) { | 80 | if (logger == null) { |
82 | - logger = Beans.getReference(Logger.class, new NameQualifier(DataSourceProducer.class.getName())); | 81 | + logger = Beans.getReference(Logger.class, new NameQualifier("br.gov.frameworkdemoiselle.util")); |
83 | } | 82 | } |
84 | 83 | ||
85 | return logger; | 84 | return logger; |
@@ -100,7 +99,7 @@ public class DataSourceProducer implements Serializable { | @@ -100,7 +99,7 @@ public class DataSourceProducer implements Serializable { | ||
100 | throw new DemoiselleException(cause); | 99 | throw new DemoiselleException(cause); |
101 | } | 100 | } |
102 | 101 | ||
103 | - getLogger().debug(getBundle().getString("datasource-name-found", dataBaseName)); | 102 | + getLogger().fine(getBundle().getString("datasource-name-found", dataBaseName)); |
104 | } | 103 | } |
105 | } | 104 | } |
106 | 105 | ||
@@ -202,7 +201,7 @@ public class DataSourceProducer implements Serializable { | @@ -202,7 +201,7 @@ public class DataSourceProducer implements Serializable { | ||
202 | Map<String, DataSource> result = cache.get(classLoader); | 201 | Map<String, DataSource> result = cache.get(classLoader); |
203 | 202 | ||
204 | if (result == null || result.isEmpty()) { | 203 | if (result == null || result.isEmpty()) { |
205 | - getLogger().debug(getBundle().getString("datasource-not-found-in-cache")); | 204 | + getLogger().fine(getBundle().getString("datasource-not-found-in-cache")); |
206 | 205 | ||
207 | for (String name : getDataSourceNames(classLoader)) { | 206 | for (String name : getDataSourceNames(classLoader)) { |
208 | create(name); | 207 | create(name); |