From jira-events at lists.jboss.org Tue Aug 19 18:03:35 2008 Content-Type: multipart/mixed; boundary="===============2211740704730995054==" MIME-Version: 1.0 From: Luca Stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Created: (JBLOGGING-6) DatasourceAppender Date: Tue, 19 Aug 2008 18:03:35 -0400 Message-ID: <27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com> --===============2211740704730995054== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable DatasourceAppender ------------------ Key: JBLOGGING-6 URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 Project: JBoss Logging Issue Type: Feature Request Security Level: Public (Everyone can see) Components: jboss-logging-log4j Affects Versions: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi Reporter: Luca Stancapiano Assignee: Dimitris Andreadis Fix For: 2.0.6.GA-spi, 1.0.0.GA-slf4j-jboss-logging hi.... what do you think about a DatasourceAppender? This is very simple. I= t overrides getConnection and closeConnection methods of org.apache.log4j.j= dbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here t= here is an example of xml file: = = = it is the same configuration for JDBCAppender but there is a 'datasource' p= arameter so you can specify the datasource location. Below there is the who= le class: /* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.logging.appender; import java.sql.Connection; import java.sql.SQLException; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; /** * An extension of the default Log4j JDBCAppender which will use a datasour= ce to * handle datas into database. * = * @version $Revision: 1958 $ * @author Luca Stancapiano */ public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppender { /** * URL of the DB for default connection handling */ protected String datasource =3D "java:/DefaultDS"; protected DataSource ds; public void setDatasource(final String datasource) { this.datasource =3D datasource; } /** * I override this method to get a connection from datasource. */ protected Connection getConnection() throws SQLException { if (connection =3D=3D null || connection.isClosed()) { if (ds =3D=3D null) try { InitialContext ic =3D new InitialContext(); ds =3D (DataSource) ic.lookup(datasource); } catch (NamingException e) { e.printStackTrace(); } connection =3D ds.getConnection(); } return connection; } protected void closeConnection(Connection con) { try { connection.close(); } catch (SQLException ex) { ex.printStackTrace(); } } } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============2211740704730995054==-- From jira-events at lists.jboss.org Tue Aug 19 18:09:23 2008 Content-Type: multipart/mixed; boundary="===============3656856241345011899==" MIME-Version: 1.0 From: Luca Stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Updated: (JBLOGGING-6) DatasourceAppender Date: Tue, 19 Aug 2008 18:09:22 -0400 Message-ID: <25644683.1219183762966.JavaMail.jira@cloud.prod.atl2.jboss.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============3656856241345011899== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Luca Stancapiano updated JBLOGGING-6: ------------------------------------- Attachment: DatasourceAppender.java I send you .java file for DatasourceAppender class > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Affects Versions: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > Reporter: Luca Stancapiano > Assignee: Dimitris Andreadis > Fix For: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============3656856241345011899==-- From jira-events at lists.jboss.org Wed Aug 20 04:38:51 2008 Content-Type: multipart/mixed; boundary="===============7130222437115131847==" MIME-Version: 1.0 From: Dimitris Andreadis (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Wed, 20 Aug 2008 04:38:51 -0400 Message-ID: <20508341.1219221531851.JavaMail.jira@cloud.prod.atl2.jboss.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7130222437115131847== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D124257= 97#action_12425797 ] = Dimitris Andreadis commented on JBLOGGING-6: -------------------------------------------- If that works well for you (i.e. you have tested it well) we can include it. > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Affects Versions: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > Reporter: Luca Stancapiano > Assignee: Dimitris Andreadis > Fix For: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7130222437115131847==-- From jira-events at lists.jboss.org Wed Aug 20 09:45:23 2008 Content-Type: multipart/mixed; boundary="===============7904062806902703779==" MIME-Version: 1.0 From: Luca Stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Wed, 20 Aug 2008 09:45:23 -0400 Message-ID: <15635782.1219239923339.JavaMail.jira@cloud.prod.atl2.jboss.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7904062806902703779== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D124258= 44#action_12425844 ] = Luca Stancapiano commented on JBLOGGING-6: ------------------------------------------ yes it is.... I tried it with local and XA Datasources.. I will send you so= me testcase too > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Affects Versions: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > Reporter: Luca Stancapiano > Assignee: Dimitris Andreadis > Fix For: 1.0.0.GA-slf4j-jboss-logging, 2.0.6.GA-spi > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7904062806902703779==-- From jira-events at lists.jboss.org Fri Mar 6 08:07:33 2009 Content-Type: multipart/mixed; boundary="===============7645721791425553466==" MIME-Version: 1.0 From: Dimitris Andreadis (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Updated: (JBLOGGING-6) DatasourceAppender Date: Fri, 06 Mar 2009 08:07:22 -0500 Message-ID: <22592811.1236344842749.JavaMail.jira@cloud.prod.atl2.jboss.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7645721791425553466== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Dimitris Andreadis updated JBLOGGING-6: --------------------------------------- Fix Version/s: 2.0.6.GA-log4j (was: 2.0.6.GA-spi) (was: 1.0.0.GA-slf4j-jboss-logging) Affects Version/s: (was: 1.0.0.GA-slf4j-jboss-logging) (was: 2.0.6.GA-spi) > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: Luca Stancapiano > Assignee: Dimitris Andreadis > Fix For: 2.0.6.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7645721791425553466==-- From jira-events at lists.jboss.org Fri Mar 6 11:29:54 2009 Content-Type: multipart/mixed; boundary="===============7298300114130666591==" MIME-Version: 1.0 From: Dimitris Andreadis (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Updated: (JBLOGGING-6) DatasourceAppender Date: Fri, 06 Mar 2009 11:29:23 -0500 Message-ID: <18933814.1236356963457.JavaMail.jira@cloud.prod.atl2.jboss.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7298300114130666591== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Dimitris Andreadis updated JBLOGGING-6: --------------------------------------- Fix Version/s: 2.0.7.GA-log4j (was: 2.0.6.GA-log4j) > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: Luca Stancapiano > Assignee: Dimitris Andreadis > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7298300114130666591==-- From jira-events at lists.jboss.org Mon Jul 27 16:57:29 2009 Content-Type: multipart/mixed; boundary="===============7458917286249958247==" MIME-Version: 1.0 From: David Lloyd (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Assigned: (JBLOGGING-6) DatasourceAppender Date: Mon, 27 Jul 2009 16:57:29 -0400 Message-ID: <1647530091.1248728249305.JavaMail.jboss@jira01.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7458917286249958247== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] David Lloyd reassigned JBLOGGING-6: ----------------------------------- Assignee: David Lloyd (was: Dimitris Andreadis) > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: Luca Stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7458917286249958247==-- From jira-events at lists.jboss.org Mon Jul 27 16:58:29 2009 Content-Type: multipart/mixed; boundary="===============8828366021929259873==" MIME-Version: 1.0 From: David Lloyd (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Mon, 27 Jul 2009 16:58:29 -0400 Message-ID: <1031418111.1248728309795.JavaMail.jboss@jira01.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============8828366021929259873== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://jira.jboss.org/jira/browse/JBLOGGING-6?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D124778= 13#action_12477813 ] = David Lloyd commented on JBLOGGING-6: ------------------------------------- Any chance you can port this to use JBoss LogManager (see http://anonsvn.jb= oss.org/repos/common/jboss-logmanager/trunk for the source code)? If you d= o so, and you include the test cases, I can merge it into this project. > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://jira.jboss.org/jira/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: Luca Stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= ps://jira.jboss.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============8828366021929259873==-- From jira-events at lists.jboss.org Thu Dec 9 23:00:52 2010 Content-Type: multipart/mixed; boundary="===============0455458412354530220==" MIME-Version: 1.0 From: luca stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Thu, 09 Dec 2010 23:00:52 -0500 Message-ID: <1998974898.3162.1291953652713.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============0455458412354530220== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569141#= comment-12569141 ] = luca stancapiano commented on JBLOGGING-6: ------------------------------------------ I read now your response...I could try..... is jboss logging deprecated? > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============0455458412354530220==-- From jira-events at lists.jboss.org Thu Dec 9 23:25:52 2010 Content-Type: multipart/mixed; boundary="===============1826362988687925797==" MIME-Version: 1.0 From: David Lloyd (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Thu, 09 Dec 2010 23:25:52 -0500 Message-ID: <2034033179.3285.1291955152634.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============1826362988687925797== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569148#= comment-12569148 ] = David Lloyd commented on JBLOGGING-6: ------------------------------------- No, it's just that JBoss Logging is *just* a logging facade API. It doesn'= t do appenders, or backends of any kind, anymore. > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============1826362988687925797==-- From jira-events at lists.jboss.org Fri Dec 10 00:04:52 2010 Content-Type: multipart/mixed; boundary="===============7267462076763029381==" MIME-Version: 1.0 From: luca stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Fri, 10 Dec 2010 00:04:52 -0500 Message-ID: <1319712584.3424.1291957492749.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7267462076763029381== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569160#= comment-12569160 ] = luca stancapiano commented on JBLOGGING-6: ------------------------------------------ Hi David. where I find jboss logging spi source codes? I would send a patch= to transform it in a OSGI bundle > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7267462076763029381==-- From jira-events at lists.jboss.org Fri Dec 10 00:39:52 2010 Content-Type: multipart/mixed; boundary="===============1750774395967685190==" MIME-Version: 1.0 From: luca stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Fri, 10 Dec 2010 00:39:52 -0500 Message-ID: <2057827895.3581.1291959592810.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============1750774395967685190== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569167#= comment-12569167 ] = luca stancapiano commented on JBLOGGING-6: ------------------------------------------ I have found. I sent a patch here: https://issues.jboss.org/browse/JBLOGGIN= G-51 thanks anyhow > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============1750774395967685190==-- From jira-events at lists.jboss.org Fri Dec 10 10:25:52 2010 Content-Type: multipart/mixed; boundary="===============1784069293786673868==" MIME-Version: 1.0 From: David Lloyd (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Fri, 10 Dec 2010 10:25:52 -0500 Message-ID: <1602385321.4853.1291994752728.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============1784069293786673868== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569287#= comment-12569287 ] = David Lloyd commented on JBLOGGING-6: ------------------------------------- The source code for these projects has recently moved. To get the latest v= ersions, go to: https://github.com/dmlloyd/jboss-logging https://github.com/dmlloyd/jboss-logmanager https://github.com/dmlloyd/jboss-logging-tools > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============1784069293786673868==-- From jira-events at lists.jboss.org Fri Dec 10 10:43:52 2010 Content-Type: multipart/mixed; boundary="===============4089140702434233066==" MIME-Version: 1.0 From: luca stancapiano (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] Commented: (JBLOGGING-6) DatasourceAppender Date: Fri, 10 Dec 2010 10:43:52 -0500 Message-ID: <457556594.4932.1291995832774.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============4089140702434233066== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jira= .plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D12569297#= comment-12569297 ] = luca stancapiano commented on JBLOGGING-6: ------------------------------------------ I need 'SPI' project > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: luca stancapiano > Assignee: David Lloyd > Fix For: 2.0.7.GA-log4j > > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- = This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============4089140702434233066==-- From jira-events at lists.jboss.org Fri May 25 13:47:18 2012 Content-Type: multipart/mixed; boundary="===============7382984455613079763==" MIME-Version: 1.0 From: David Lloyd (JIRA) To: jboss-jira at lists.jboss.org Subject: [jboss-jira] [JBoss JIRA] (JBLOGGING-6) DatasourceAppender Date: Fri, 25 May 2012 13:47:18 -0400 Message-ID: <40186041.111032.1337968038284.JavaMail.tomcat@jira02.app.mwc.hst.phx2.redhat.com> In-Reply-To: 27181334.1219183415489.JavaMail.jira@cloud.prod.atl2.jboss.com --===============7382984455613079763== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable [ https://issues.jboss.org/browse/JBLOGGING-6?page=3Dcom.atlassian.jir= a.plugin.system.issuetabpanels:all-tabpanel ] David Lloyd resolved JBLOGGING-6. --------------------------------- Resolution: Out of Date Closing this issue because this legacy framework no longer exists. That sa= id, a data source appender isn't a bad idea - if you're still interested in= this feature, open a new issue in the LOGMGR project. = > DatasourceAppender > ------------------ > > Key: JBLOGGING-6 > URL: https://issues.jboss.org/browse/JBLOGGING-6 > Project: JBoss Logging > Issue Type: Feature Request > Security Level: Public(Everyone can see) = > Components: jboss-logging-log4j > Reporter: Luca Stancapiano > Assignee: David Lloyd > Attachments: DatasourceAppender.java > > > hi.... what do you think about a DatasourceAppender? This is very simple.= It overrides getConnection and closeConnection methods of org.apache.log4j= .jdbc.JDBCAppender class and it is configurable by a *-log4j.xml file. Here= there is an example of xml file: > > > > = > > > > > "INSERT INTO JBP_LOGGING_SAMPLES_USERS (log_date, log_type, log_user, o= peration) VALUES ( '%d{yyyy-MM-dd HH:mm:ss.SSS}','%p', '%C;%L', '%C;%L')"/> > > > = > > > > = > > it is the same configuration for JDBCAppender but there is a 'datasource'= parameter so you can specify the datasource location. Below there is the w= hole class: > /* > * JBoss, Home of Professional Open Source > * Copyright 2005, JBoss Inc., and individual contributors as indicated > * by the @authors tag. See the copyright.txt in the distribution for a > * full listing of individual contributors. > * > * This is free software; you can redistribute it and/or modify it > * under the terms of the GNU Lesser General Public License as > * published by the Free Software Foundation; either version 2.1 of > * the License, or (at your option) any later version. > * > * This software is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > * Lesser General Public License for more details. > * > * You should have received a copy of the GNU Lesser General Public > * License along with this software; if not, write to the Free > * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA > * 02110-1301 USA, or see the FSF site: http://www.fsf.org. > */ > package org.jboss.logging.appender; > import java.sql.Connection; > import java.sql.SQLException; > import javax.naming.InitialContext; > import javax.naming.NamingException; > import javax.sql.DataSource; > /** > * An extension of the default Log4j JDBCAppender which will use a dataso= urce to > * handle datas into database. > * = > * @version $Revision: 1958 $ > * @author Luca Stancapiano > */ > public class DatasourceAppender extends org.apache.log4j.jdbc.JDBCAppende= r { > /** > * URL of the DB for default connection handling > */ > protected String datasource =3D "java:/DefaultDS"; > protected DataSource ds; > public void setDatasource(final String datasource) { > this.datasource =3D datasource; > } > /** > * I override this method to get a connection from datasource. > */ > protected Connection getConnection() throws SQLException { > if (connection =3D=3D null || connection.isClosed()) { > if (ds =3D=3D null) > try { > InitialContext ic =3D new InitialContext(); > ds =3D (DataSource) ic.lookup(datasource); > } catch (NamingException e) { > e.printStackTrace(); > } > connection =3D ds.getConnection(); > } > return connection; > } > protected void closeConnection(Connection con) { > try { > connection.close(); > } catch (SQLException ex) { > ex.printStackTrace(); > } > } > } -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.jboss.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira =20 --===============7382984455613079763==--