Commit fc2b23f354c453d62df07dc21709b6d59d019ab0

Authored by Cleverson Sacramento
1 parent e277212d
Exists in master

FWK-202: Injeção de java.util.logging.Logger

Task-Url: https://demoiselle.atlassian.net/browse/FWK-202
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ConnectionProducer.java
... ... @@ -43,6 +43,7 @@ import java.util.Collections;
43 43 import java.util.HashMap;
44 44 import java.util.Map;
45 45 import java.util.Set;
  46 +import java.util.logging.Logger;
46 47  
47 48 import javax.annotation.PostConstruct;
48 49 import javax.annotation.PreDestroy;
... ... @@ -52,8 +53,6 @@ import javax.enterprise.inject.Produces;
52 53 import javax.enterprise.inject.spi.InjectionPoint;
53 54 import javax.inject.Inject;
54 55  
55   -import org.slf4j.Logger;
56   -
57 56 import br.gov.frameworkdemoiselle.DemoiselleException;
58 57 import br.gov.frameworkdemoiselle.annotation.Name;
59 58 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
... ... @@ -81,7 +80,7 @@ public class ConnectionProducer implements Serializable {
81 80  
82 81 private Logger getLogger() {
83 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 86 return logger;
... ... @@ -148,7 +147,7 @@ public class ConnectionProducer implements Serializable {
148 147 try {
149 148 connection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
150 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 156 connection.setAutoCommit(false);
158 157  
159 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 164 String result = config.getDefaultDataSourceName();
166 165  
167 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 170 return result;
... ... @@ -194,7 +193,7 @@ public class ConnectionProducer implements Serializable {
194 193  
195 194 try {
196 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 198 } else {
200 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 42 import java.util.HashSet;
43 43 import java.util.Map;
44 44 import java.util.Set;
  45 +import java.util.logging.Logger;
45 46  
46 47 import javax.annotation.PostConstruct;
47 48 import javax.annotation.PreDestroy;
... ... @@ -51,8 +52,6 @@ import javax.naming.InitialContext;
51 52 import javax.naming.NamingException;
52 53 import javax.sql.DataSource;
53 54  
54   -import org.slf4j.Logger;
55   -
56 55 import br.gov.frameworkdemoiselle.DemoiselleException;
57 56 import br.gov.frameworkdemoiselle.internal.configuration.JDBCConfig;
58 57 import br.gov.frameworkdemoiselle.internal.proxy.BasicDataSourceProxy;
... ... @@ -79,7 +78,7 @@ public class DataSourceProducer implements Serializable {
79 78  
80 79 private Logger getLogger() {
81 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 84 return logger;
... ... @@ -100,7 +99,7 @@ public class DataSourceProducer implements Serializable {
100 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 201 Map<String, DataSource> result = cache.get(classLoader);
203 202  
204 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 206 for (String name : getDataSourceNames(classLoader)) {
208 207 create(name);
... ...