Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Log4jInit extends HttpServlet{
- private static final long serialVersionUID = 1L;
- public void init(){
- String file = getInitParameter(Constantes.LOG4JINIT);
- try{
- if(file != null){
- Properties props = new Properties();
- props.load(new FileInputStream(file));
- PropertyConfigurator.configure(props);
- }
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- <servlet>
- <servlet-name>log4j-init</servlet-name>
- <servlet-class>es.elcorteingles.n005.utils.Log4jInit</servlet-class>
- <init-param>
- <param-name>log4j-init-file</param-name>
- <param-value>classpath:log4j.properties</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <resource>
- <directory>src/main/resource</directory>
- <targetPath>${project.build.directory}</targetPath>
- <filtering>true</filtering>
- <includes>
- <include>**/*.properties</include>
- </includes>
- </resource>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement