  | |  | Log4J and JMS | Log4J and JMS 2003-05-01 - By Vivek Kapadekar
Back Thanks Steve, I atleast owe you a lunch :-) Mark, surely would like to share my experience with log4j and JMS. Most of the reason for the bumpy ride I had was because I am using Orion and JMS for the first time....My main aim is to get the distributed logging working...and the sample programs that I wrote seem to work...Once its finally complete... will post it to either the dev list or wiki... Thanks again --Viv
On Thu, 2003-05-01 at 09:02, Ebersole, Steven wrote: > No need my friend (why reinvent the wheel). Below is my custom JMS queue > appender which we have been using in production for over a year now. I > still want to add a fallback error handler, but never have the time ;o) > > > import javax.jms.*; > import javax.naming.InitialContext ; > import javax.naming.Context ; > import javax.naming.NameNotFoundException ; > import javax.naming.NamingException ; > import java.util.Hashtable ; > > import org.apache.log4j.AppenderSkeleton ; > import org.apache.log4j.spi.LoggingEvent ; > import org.apache.log4j.spi.ErrorHandler ; > import org.apache.log4j.spi.ErrorCode ; > import org.apache.log4j.helpers.LogLog ; > import org.apache.log4j.helpers.OptionConverter ; > > > public class JMSQueueAppender > extends org.apache.log4j.AppenderSkeleton  > { > QueueConnection conn; > QueueSession sess; > QueueSender sender; > > String queueBindingName; > String cfBindingName; > String contextFactory; > String providerUrl; > > /** Creates a new instance of JMSQueueAppender */ > public JMSQueueAppender() > { > super(); > } > > > public void setContextFactory( String contextFactory ) > { > this.contextFactory = contextFactory; > } > > > public String getContextFactory() > { > return contextFactory; > } > > > public void setProviderUrl( String providerUrl ) > { > this.providerUrl = providerUrl; > } > > > public String getProviderUrl() > { > return providerUrl; > } > > > public void setQueueConnectionFactoryBindingName( String cfBindingName ) > { > this.cfBindingName = cfBindingName; > } > > > /** > * Returns the value of the <b>QueueConnectionFactoryBindingName</b> > option. > */ > public String getQueueConnectionFactoryBindingName() > { > return cfBindingName; > } > > > /** > * The <b>QueueBindingName</b> option takes a > * string value. Its value will be used to lookup the appropriate > * <code>javax.jms.Queue </code> from the JNDI context. > */ > public void setQueueBindingName(String queueBindingName) > { > this.queueBindingName = queueBindingName; > } > > > /** > * Returns the value of the <b>QueueBindingName</b> option. > */ > public String getQueueBindingName() > { > return queueBindingName; > } > > > public boolean requiresLayout() > { > return false; > } > > > public synchronized void close() > { > if(this.closed) > return; > > LogLog.debug("Closing appender ["+name+"]."); > this.closed = true; > > try > { > if(sess != null) > sess.close(); > if(conn != null) > conn.close(); > } > catch(Exception e) > { > LogLog.error("Error while closing JMSQueueAppender ["+name+"].", > e); > } > // Help garbage collection > sender = null; > sess = null; > conn = null; > } > > > public void append(LoggingEvent event) > { > if(!checkEntryConditions()) > { > return; > } > > try > { > event.getLocationInformation(); > > ObjectMessage msg = sess.createObjectMessage( event ); > sender.send( msg ); > } > catch(Exception e) > { > errorHandler.error("Could not publish message in > JMSQueueAppender ["+name+"].", e, > ErrorCode.GENERIC_FAILURE); > } > } > > > public void activateOptions() > { > QueueConnectionFactory cf; > > try > { > Hashtable ht = new Hashtable(); > > if (contextFactory==null) > { > ht.put( Context.INITIAL_CONTEXT_FACTORY, > System.getProperty( Context.INITIAL_CONTEXT_FACTORY ) ); > } > else > { > ht.put( Context.INITIAL_CONTEXT_FACTORY, contextFactory ); > } > > if (providerUrl==null) > { > ht.put( Context.PROVIDER_URL, > System.getProperty( Context.PROVIDER_URL ) ); > } > else > { > ht.put( Context.PROVIDER_URL, providerUrl ); > } > > Context ctx = new InitialContext( ht ); > cf = (QueueConnectionFactory)lookup( ctx, cfBindingName ); > conn = cf.createQueueConnection(); > conn.start(); > > sess = conn.createQueueSession( false, Session.AUTO_ACKNOWLEDGE > ); > Queue queue = (Queue)lookup( ctx, queueBindingName ); > sender = sess.createSender( queue ); > > ctx.close(); > } > catch( Exception e ) > { > errorHandler.error("Error while activating options for appender > named ["+name+ > "].", e, ErrorCode.GENERIC_FAILURE); > } > } > > > protected Object lookup( Context ctx, String name ) > throws NamingException > { > try > { > return ctx.lookup( name ); > } > catch( NameNotFoundException nnfe ) > { > LogLog.error( "Unable to locate JNDI name [" + name + "]" ); > throw nnfe; > } > } > > > protected boolean checkEntryConditions() > { > String fail = null; > > if (this.conn==null) > { > fail = "No QueueConnection"; > } > else if (this.sess==null) > { > fail = "No QueueSession"; > } > else if (this.sender==null) > { > fail = "No QueueSender"; > } > > if (fail != null) > { > errorHandler.error(fail + " for JMSQueueAppender named > ["+name+"]."); > return false; > } > else > { > return true; > } > } > > } > > > > > -- --Original Message-- -- > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > Sent: Thursday, May 01, 2003 3:50 AM > To: Log4J Users List > Subject: RE: Log4J and JMS > > > It all worked finally.. this is the subscriber code snapshot > try { > if ( message instanceof ObjectMessage ) { > ObjectMessage objMsg = (ObjectMessage) message; > if ( objMsg.getObject() instanceof LoggingEvent) { > LoggingEvent logObject =(LoggingEvent)objMsg.getObject(); > System.out.println("Reading" + > logObject.getRenderedMessage()); > } > } > catch(JMSException e) { > System.out.println(" Exceptionin onMessage " + e.getMessage()); > e.printStackTrace(); > } > > > Thanks very much for the help, especially Steve and Mark..Now am abt to > implement JMSAppender for Queues... > > --Vivek > On Thu, 2003-05-01 at 08:29, Ebersole, Steven wrote: > > Also, as an aside, message properties are not required things. You might > > want to read up on the JMS spec (or even the javadocs for some of these > > objects). Message properties are in essence application specific headers > > and are mainly intended to be used in conjunction with message selectors. > > The meaning here is that if I am writing a heavily JMS dependent app, I > can > > embed attributes that are completely custom to my app into these > properties. > > But they have nothing to do with JMS itself. > > > > Log4j in and of itself is not really an app, and is by no means a JMS app. > > Thus it has no need to set custom message properties. > > > > > > > > -- --Original Message-- -- > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > Sent: Thursday, May 01, 2003 3:11 AM > > To: Log4J Users List > > Subject: RE: Log4J and JMS > > > > > > public static void main(String args[]) { > > TopicConnection connection = null; > > try { > > char answer = '\0'; > > System.out.println("Getting Topic"); > > InitialContext initContext = new InitialContext(); > > TopicConnectionFactory factory = > > > (TopicConnectionFactory)initContext.lookup("jms/theTopicConnectionFactory"); > > > > connection = factory.createTopicConnection(); > > Topic topic = (Topic)initContext.lookup( > > "jms/theTopic"); > > > > TopicSession tsession > > connection.createTopicSession(false,Session .AUTO_ACKNOWLEDGE); > > TopicSubscriber tsubscriber = tsession.createSubscriber(topic); > > Listener topicListener = new Listener(); > > tsubscriber.setMessageListener(topicListener); > > connection.start(); > > InputStreamReader input = new InputStreamReader(System.in); > > while (!((answer=='q') )) { > > try { > > answer = (char)input.read(); > > } > > catch(IOException ie){} > > } > > > > } > > catch (Exception e) { > > e.printStackTrace(); > > } > > finally { > > if ( connection !=null ) { > > try { > > connection.close(); > > } > > catch(JMSException e){ > > System.out.println(" ExCeption " + e.getMessage()); > > } > > } > > } > > } > > > > And the Listerner code is > > public void onMessage(Message message) { > > try { > > // I see this output line..... > > System.out.println(" Got a message " + message); > > > > if ( message instanceof TextMessage ) { > > TextMessage txtmsg = (TextMessage)message; > > System.out.println(" Reading the message " + txtmsg.getText()); > > } > > } > > catch(JMSException e) { > > System.out.println(" Exceptionin onMessage " + e.getMessage()); > > e.printStackTrace(); > > } > > > > > > I produce the Messages from Log4J by setting the JMSAppender properties > > in the log4j.properties and invoke this > > Logger lo = Logger.getRootLogger(); > > lo.setLevel(Level.ALL); > > lo.warn(" Test Message "); > > > > > > > > When I call the logger.warn method, it did invoke the onMessage() of the > > MessageListener.But it seems, it did not write it in the right format, > > all the properties of the message object are null....like > > message.getJMSType() etc...cannot read the actual message string..... > > Is there a specific way in which i have to write the message to log4j, > > so that it published to the topic correctly, or log4J wraps it in the > > right MessageObject ( perhaps TextMessage ) and publishes it? > > > > Thanks > > --Vivek > > > > On Wed, 2003-04-30 at 17:18, Mark Womack wrote: > > > Do you have your own code that can successfully send messages across > this > > > topic, configured the same way? Code that is not related to log4j. If > > so, > > > how does it compare to the code in the log4j JMSAppender? > > > > > > -Mark > > > > > > > -- --Original Message-- -- > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > Sent: Wednesday, April 30, 2003 10:14 AM > > > > To: Log4J Users List > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > Hi All > > > > I tried many ways, but everytime it seems, it comes to the point where > > > > JMSAppender has to publish to the Topic and it just waits there.... It > > > > does not proceed from that point onwards.. > > > > Here is another way I set all the properties inside the code: > > > > > > > > > > > > Logger lo = Logger.getRootLogger(); > > > > JMSAppender jms = new JMSAppender(); > > > > jms.setInitialContextFactoryName(JNDI_FACTORY); > > > > jms.setProviderURL("ormi://surya"); > > > > jms.setSecurityCredentials("bitfone"); > > > > jms.setSecurityPrincipalName("admin"); > > > > > > > > jms.setTopicConnectionFactoryBindingName("jms/theTopicConnecti > > > > onFactory"); > > > > jms.setTopicBindingName("jms/theTopic"); > > > > jms.activateOptions(); > > > > lo.addAppender(jms); > > > > System.out.println(" Init Fact name "+ > > > > jms.getInitialContextFactoryName()); > > > > lo.setLevel(Level.ALL); > > > > lo.warn("Test"); > > > > > > > > > > > > At this point , it just waits, and does not proceed... > > > > > > > > any ideas......am I missing something.. > > > > --Vivek > > > > > > > > On Wed, 2003-04-30 at 14:01, Ebersole, Steven wrote: > > > > > Again, i do not know Orion, but you should just be able to > > > > change the > > > > > provider URL to point to the server running Orion. This is > > > > exactly what I > > > > > do on weblogic and jboss. > > > > > > > > > > In your subscriber code, try change the provider url from > > > > > "ormi://localhost:9127" to "ormi://your.server.running.orion:9127" > > > > > > > > > > -- --Original Message-- -- > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > Sent: Wednesday, April 30, 2003 8:39 AM > > > > > To: Log4J Users List > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > yeah I think you are right...Thing is that the consumer code is a > > > > > standalone code, it is not running inside the Orion server, > > > > though it > > > > > uses theh JMS implementation of Orion. could that be a problem. > > > > > If I run the consumer code inside the Orion server i do not get that > > > > > error, ( though I havent sucessfully been able to read the message ) > > > > > > > > > > > > > > > On Wed, 2003-04-30 at 13:28, Ebersole, Steven wrote: > > > > > > Ahh... its a NamingException, not a JMSException. Big > > > > difference... > > > > > > > > > > > > Basically this means that there is a problem in the > > > > Consumer code's > > > > > provider > > > > > > url. Are both of these getting run from the same box? > > > > In the subscriber > > > > > > code you are telling the InitialContext to connect to the url > > > > > > "ormi://localhost:9127". The error is stating that > > > > whatever was using the > > > > > > 9127 port on the machine where the subscriber was run > > > > does not understand > > > > > > the ormi protocol (I'm guessing that ormi is orion's protocol). > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > Sent: Wednesday, April 30, 2003 8:22 AM > > > > > > To: Log4J Users List > > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > > > > Yes, they are executed in separate process/VM. > > > > > > > > > > > > Here is the stack Trace when I execute the Consumer code.... > > > > > > > > > > > > > > > > > > About to Set the Initial Context > > > > > > javax.naming.NamingException : Error reading application-client > > > > > > descriptor: Error communicating with server: IO error: > > > > > > java.io.IOException : Server protocol was not ORMI, if > > > > uncertain about > > > > > > the port your server uses for ORMI then use the default, > > > > 23791; nested > > > > > > exception is: > > > > > > java.io.IOException : Server protocol was not > > > > ORMI, if uncertain > > > > > > about the port your server uses for ORMI then use the > > > > default, 23791; > > > > > > nested exception is: > > > > > > javax.naming.NamingException : IO error: > > > > java.io.IOException : > > > > > > Server protocol was not ORMI, if uncertain about the port > > > > your server > > > > > > uses for ORMI then use the default, 23791; nested exception is: > > > > > > java.io.IOException : Server protocol was not > > > > ORMI, if uncertain > > > > > > about the port your server uses for ORMI then use the > > > > default, 23791 > > > > > > at com.evermind._am._tqd(.:951) > > > > > > at > > > > > > > > > > > > > > > com.evermind.server.ApplicationClientInitialContextFactory.get > > > > InitialContext > > > > > > (.:179) > > > > > > at > > > > > > > > > > javax.naming.spi.NamingManager (NamingManager > > > > .java:662) > > > > > > at > > > > > > > > > > javax.naming.InitialContext (InitialContext.java:243) > > > > > > at > > > > javax.naming.InitialContext (InitialContext.java:219) > > > > > > at > > > > javax.naming.InitialContext <init>(InitialContext.java:195) > > > > > > at dls.Consumer.main(Consumer.java:34) > > > > > > > > > > > > On Wed, 2003-04-30 at 12:16, Ebersole, Steven wrote: > > > > > > > Two things: > > > > > > > > > > > > > > 1) How are these pieces executed in relation to each > > > > other? Are they > > > > > run > > > > > > > from the same process? > > > > > > > 2) Can you also include the stack trace from the JMSException > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > > Sent: Wednesday, April 30, 2003 7:01 AM > > > > > > > To: Log4J Users List > > > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > > > > > > > Hi > > > > > > > This is the code snapshot: > > > > > > > > > > > > > > Publisher code > > > > > > > ==============> > > > > > > private static final String > > > > > > > > > > > > > > > > JNDI_FACTORY="com.evermind.server.ApplicationClientInitialCont > > > > extFactory"; > > > > > > > Context ctx = null; > > > > > > > Hashtable ht1 = new Hashtable(); > > > > > > > ht1.put(Context.SECURITY_PRINCIPAL, "admin"); > > > > > > > ht1.put(Context.SECURITY_CREDENTIALS, "admin"); > > > > > > > ht1.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY); > > > > > > > ht1.put(Context.PROVIDER_URL, "ormi://localhost:9127"); > > > > > > > try { > > > > > > > ctx = new InitialContext(ht1); > > > > > > > TopicConnectionFactory factory > > > > > > > (TopicConnectionFactory)ctx.lookup( > > > > > > > "java:comp/env/jms/theTopicConnectionFactory" ); > > > > > > > TopicConnection conn = factory.createTopicConnection(); > > > > > > > conn.start(); > > > > > > > TopicSession session = conn.createTopicSession(true, > > > > > > > Session.AUTO_ACKNOWLEDGE ); > > > > > > > // Does the returned session think its transacted anyway? > > > > > > > System.out.println( "Is session transacted? : " + > > > > > > > session.getTransacted() ); > > > > > > > > > > > > > > Topic topic = (Topic)ctx.lookup( > > > > "java:comp/env/jms/theTopic" ); > > > > > > > TopicPublisher publisher = > > > > session.createPublisher( topic ); > > > > > > > publisher.publish( session.createTextMessage( > > > > "Test message" ) ); > > > > > > > System.out.println(" Published the message"); > > > > > > > } > > > > > > > catch( Exception e ) > > > > > > > { > > > > > > > System.err.println( "Error occurred : " + e ); > > > > > > > e.printStackTrace( System.err ); > > > > > > > } > > > > > > > finally > > > > > > > { > > > > > > > if (ctx != null) try { ctx.close(); } catch > > > > (Throwable ignore) {} > > > > > > > } > > > > > > > > > > > > > > ===================================================> > > > > > > Consumer Code > > > > > > > ==================> > > > > > > try { > > > > > > > System.out.println("Getting Topic"); > > > > > > > Hashtable ht = new Hashtable(); > > > > > > > ht.put(Context.SECURITY_PRINCIPAL, "admin"); > > > > > > > ht.put(Context.SECURITY_CREDENTIALS, "admin"); > > > > > > > ht.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY); > > > > > > > ht.put(Context.PROVIDER_URL, "ormi://localhost:9127"); > > > > > > > System.out.println(" About to Set the Initial Context"); > > > > > > > InitialContext initContext = new InitialContext(ht); > > > > > > > TopicConnectionFactory factory > > > > > > > > > > > > > > > > > > > > > > (TopicConnectionFactory)initContext.lookup("java:comp/env/jms/ > > > > theTopicConnec > > > > > > > tionFactory"); > > > > > > > TopicConnection connection = > > > > factory.createTopicConnection(); > > > > > > > Topic topic = (Topic)initContext.lookup( > > > > > > > "java:comp/env/jms/theTopic"); > > > > > > > TopicSession tsession = > > > > > > > > > > > connection.createTopicSesson(true,TopicSession.AUTO_ACKNOWLEDGE); > > > > > > > TopicSubscriber tsubscriber = > > > > tsession.createSubscriber(topic); > > > > > > > Message m = tsubscriber.receive(); > > > > > > > } > > > > > > > catch (Exception e) { > > > > > > > System.out.println(" JMS Exception: " + e.getMessage()); > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > --Vivek > > > > > > > On Wed, 2003-04-30 at 11:40, Ebersole, Steven wrote: > > > > > > > > I have never used the JMSSink, so I cannot say. > > > > > > > > > > > > > > > > It does not make sense that you would get a JMSException when > > > > > ontaining > > > > > > an > > > > > > > > InitialContext. Post the code you are using to > > > > publish to the topic > > > > > and > > > > > > > the > > > > > > > > code you are using to subscribe to the topic so I can > > > > see what you > > > > > might > > > > > > > be > > > > > > > > doing wrong. > > > > > > > > > > > > > > > > > > > > > > > > As an aside, acknowledgement mode is ignored when specifying a > > > > > > transacted > > > > > > > > session. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > > > Sent: Wednesday, April 30, 2003 6:23 AM > > > > > > > > To: Log4J Users List > > > > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > > > > > > > > > > If I set it to true > > > > > > > > ( TopicSession session = conn.createTopicSession( true, > > > > > > > > Session.AUTO_ACKNOWLEDGE ); ) > > > > > > > > > > > > > > > > then it does not hang, writes to the Topic and proceeds. > > > > > > > > But in my consumer program I am not able to read it. > > > > > > > > As soon as I go an new InitialContext() I get this error > > > > > > > > "JMS Exception: Error reading application-client descriptor:" > > > > > > > > Any ideas? Or should I just use JMSSink? > > > > > > > > > > > > > > > > --Vivek > > > > > > > > > > > > > > > > > > > > > > > > On Wed, 2003-04-30 at 10:58, Ebersole, Steven wrote: > > > > > > > > > Sorry, apparently those were added. They were just > > > > not bolded as > > > > > > > > > configurable appender options normally are. > > > > > > > > > > > > > > > > > > So what exactly are your config parameters now? > > > > > > > > > > > > > > > > > > You say that the message is delivered to the topic, > > > > AND THEN the > > > > > > program > > > > > > > > > blocks? That is almost certainly an > > > > acknowledgement issue. I know > > > > > > that > > > > > > > > the > > > > > > > > > JMSAppender (at least up to 1.2.7) does use auto > > > > acknowledgement > > > > > mode > > > > > > > for > > > > > > > > > its session. So really the only other thing it > > > > could be is an > > > > > > > uncommited > > > > > > > > > transaction. I dont use Orion, but I remember > > > > someone poting a > > > > > > similiar > > > > > > > > > issue here about 9 months ago and I think that they > > > > might have been > > > > > > > using > > > > > > > > > Orion. The problem was that there particular app > > > > server did not > > > > > allow > > > > > > > > > creating transacted vs. non-transacted sessions on > > > > a session by > > > > > > session > > > > > > > > > basis. Rather it ended up being a server-wide > > > > configuration. They > > > > > > had > > > > > > > > set > > > > > > > > > their server up for transacted JMS sessions; then > > > > when log4j obtains > > > > > a > > > > > > > > > session it specifies non-transacted and > > > > auto-acknowledgement. So as > > > > > > far > > > > > > > > as > > > > > > > > > log4j is concerned as soon as the message is sent > > > > its job is done > > > > > > (which > > > > > > > > > should be true according to the J2EE spec section on JMS). > > > > > > > > > > > > > > > > > > Try sending a message to your topic outside of > > > > log4j and see if the > > > > > > same > > > > > > > > > thing happens. > > > > > > > > > > > > > > > > > > Context ctx = null; > > > > > > > > > try > > > > > > > > > { > > > > > > > > > ctx = new InitialContext(); > > > > > > > > > TopicConnectionFactory factory > > > > > > (TopicConnectionFactory)ctx.lookup( > > > > > > > > > TCF_NAME ); > > > > > > > > > TopicConnection conn = factory.createTopicConnection(); > > > > > > > > > topicConnection.start(); > > > > > > > > > > > > > > > > > > TopicSession session = conn.createTopicSession( false, > > > > > > > > > Session.AUTO_ACKNOWLEDGE ); > > > > > > > > > // Does the returned session think its > > > > transacted anyway? > > > > > > > > > System.out.prinltn( "Is session transacted? : " + > > > > > > > > > session.getTransacted() ); > > > > > > > > > > > > > > > > > > Topic topic = (Topic)ctx.lookup( TOPIC_NAME ); > > > > > > > > > TopicPublisher publisher = > > > > topicSession.createPublisher( topic > > > > > ); > > > > > > > > > > > > > > > > > > publisher.publish( session.createTextMessage( > > > > "Test message" ) > > > > > ); > > > > > > > > > } > > > > > > > > > catch( Exception e ) > > > > > > > > > { > > > > > > > > > System.err.println( "Error occurred : " + e ); > > > > > > > > > e.printStackTrace( System.err ); > > > > > > > > > } > > > > > > > > > finally > > > > > > > > > { > > > > > > > > > if (ctx != null) try { ctx.close(); } catch > > > > (Throwable ignore) > > > > > {} > > > > > > > > > } > > > > > > > > > > > > > > > > > > Does it hang here also? What is printed out as the > > > > result of the > > > > > > > > > getTransacted() call? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > > > > Sent: Wednesday, April 30, 2003 5:05 AM > > > > > > > > > To: Log4J Users List > > > > > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > > > > > > > > > > > > > Oh yes, I am using > > > > org.apache.log4j.net.JMSAppender ( log4j version > > > > > > > > > 1.2.8 ) The api docs for JMSAppender also show > > > > those methods. > > > > > > > > > http://jakarta.apache.org/log4j/docs/api/ > > > > > > > > > > > > > > > > > > Anyways, I dont need them as I have set those > > > > properties in the > > > > > > > > > log4j.properties. > > > > > > > > > > > > > > > > > > About the AUTO_ACKNOWLEDGE, that can be we create > > > > > > > > > topicConnetion.createTopicSession, right.. But I > > > > thought JMSAppender > > > > > > > > > looks up for topicConnectionFactory and sets all > > > > those properties > > > > > > > > > Is there a way we can tell JMSAppender to > > > > explicitly set those > > > > > > > > > properties after it looks up the the Topic from jndi ? > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > --Vivek > > > > > > > > > > > > > > > > > > On Wed, 2003-04-30 at 09:48, Ebersole, Steven wrote: > > > > > > > > > > I thought that you were using the > > > > org.apache.log4j.net.JMSAppender  > > > > > > > > > appender? > > > > > > > > > > That class has none of the methods you list here. > > > > > > > > > > > > > > > > > > > > As for the jndi.properties file, the JMSAppender uses the > > > > > > > InitialContext > > > > > > > > > > constructor form taking a Hashtable of properties > > > > which I think > > > > > > > excludes > > > > > > > > > the > > > > > > > > > > use of jndi.properties config file. I am not > > > > certain about that, > > > > > > but > > > > > > > > that > > > > > > > > > > was my understanding. > > > > > > > > > > > > > > > > > > > > As for it blocking, my guess is that you are > > > > maybe using a custom > > > > > > > > > jms-based > > > > > > > > > > appender given those additional properties. If > > > > so, make sure you > > > > > > are > > > > > > > > > > setting the acknowledgement mode to auto. > > > > Otherwise, the server > > > > > > would > > > > > > > > > block > > > > > > > > > > until the consumer acknowledge receipt of the message. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > > > > > Sent: Wednesday, April 30, 2003 3:53 AM > > > > > > > > > > To: Log4J Users List > > > > > > > > > > Subject: RE: Log4J and JMS > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks..I got around that problem by setting > > > > those properties in > > > > > > > > > > log4.properties file. > > > > > > > > > > I had these properties set in jndi.properties > > > > file, and I thought > > > > > it > > > > > > > > > > would read from there, but anyways. > > > > > > > > > > I am not getting that error, but I am not sure, > > > > if the log is > > > > > > writing > > > > > > > to > > > > > > > > > > the JMS Topic...I have these lines of code. > > > > > > > > > > > > > > > > > > > > Logger log = Logger.getRootLogger(); > > > > > > > > > > JMSAppender jms = (JMSAppender)lo.getAppender("JMS1"); > > > > > > > > > > jms.setProviderURL("ormi://localhost:9127"); > > > > > > > > > > jms.setSecurityCredentials("bitfone"); > > > > > > > > > > jms.setSecurityPrincipalName("admin"); > > > > > > > > > > log.setLevel(Level.ALL); > > > > > > > > > > log.debug("Writing to the Topic"); > > > > > > > > > > > > > > > > > > > > When I run it, it displays the message that I am > > > > writing to the > > > > > > > Topic. > > > > > > > > > > But after that it just waits there.. I does not > > > > process with the > > > > > > next > > > > > > > > > > statements. > > > > > > > > > > I am looking for asynchronous messaging, so i > > > > hope that it will > > > > > > write > > > > > > > to > > > > > > > > > > the Topic and proceed.. Is it necessary that I > > > > have to create > > > > > > > > > > subscribers or use JMSSink? Another thing is even > > > > though I am > > > > > > setting > > > > > > > > > > the securitycredentials in the code, it shows me > > > > a dialog box to > > > > > > enter > > > > > > > > > > the user name and password...I am using Orion > > > > server and its JMS > > > > > > > > > > implementation... > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > --vivek > > > > > > > > > > > > > > > > > > > > On Wed, 2003-04-30 at 07:11, Ebersole, Steven wrote: > > > > > > > > > > > In the properties file. Take a look at the > > > > javadocs for that > > > > > > > > > JMSAppender > > > > > > > > > > > class. It notes its configurable properties in > > > > bold in the > > > > > method > > > > > > > > > > javadocs > > > > > > > > > > > (this is true for all the appenders). > > > > JMSAppender allows the > > > > > > > > following > > > > > > > > > > > parameters: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > log4j.appender.JMS1.InitialContextFactoryName=your_servers_ini > > > > tial_context_f > > > > > > > > > > > actory_class_name > > > > > > > > > > > > > > > > log4j.appender.JMS1.TopicBindingName=your_jms_topic_jndi_bind_name > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > log4j.appender.JMS1.TopicConnectionFactoryBindingName=your_ser > > > > vers_jms_topic > > > > > > > > > > > _connection_factory_jndi_bind_name > > > > > > > > > > > > > > > > > > > > > > Please note that there is no property to > > > > specify the jndi-url to > > > > > > > your > > > > > > > > > > server > > > > > > > > > > > running the topic. The implication is that either: > > > > > > > > > > > 1) You must run this code from within the > > > > process running the > > > > > JMS > > > > > > > > topic; > > > > > > > > > > > 2) Manually set the > > > > javax.naming.Context system > > > > > > > property. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- --Original Message-- -- > > > > > > > > > > > From: Vivek Kapadekar [mailto:vkapadekar@(protected)] > > > > > > > > > > > Sent: Tuesday, April 29, 2003 6:57 PM > > > > > > > > > > > To: log4j-user@(protected) > > > > > > > > > > > Subject: Log4J and JMS > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi all > > > > > > > > > > > I get this error , when I set the JMSAppender > > > > as one of the > > > > > > > appenders > > > > > > > > > > > for the root Logger. > > > > > > > > > > > > > > > > > > > > > > log4j:ERROR Error while activating options for > > > > appender named > > > > > [J]. > > > > > > > > > > > java.lang.NullPointerException  > > > > > > > > > > > > > > > > > > > > > > What settings am I missing, and where do I set those? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Sun, 2003-04-27 at 19:36, Yves Desfoss??s wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > > > > > > > > I need to deploy on Domino 5.0.3 my log4 > > > > application, the same > > > > > > > > > > > > application is deployed on other platform > > > > than Domino and it > > > > > > > works. > > > > > > > > > Now > > > > > > > > > > > > my problem is to configured Domino to get find my > > > > > > log4j.properties > > > > > > > > > > > > because I can???t put it in the classpath. The > > > > same application > > > > > is > > > > > > > > > > > > deployed on Weblogic and I had to add the directive: > > > > > > > > > > > > > > > > > > > > > > > > > > > > -Dlog4j.properties=file:/d/foo/log4j.properties and it works > > > > > > fine, > > > > > > > > but > > > > > > > > > > > > how can I do the same or the equivalent on > > > > Domino, I don???t > > > > > know > > > > > > > > where > > > > > > > > > to > > > > > > > > > > > > put this directive, Domino is a black box to me. > > > > > > > > > > > > > > > > > > > > > > > > Hope other people than me uses Domino !!! > > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > __ ____ ____ ____ ___ > > > > > > > > > > > > Yves Desfoss??s > > > > > > > > > > > > SOL-YD Informatique Inc. > > > > > > > > > > > > 23 du Castillo > > > > > > > > > > > > Blainville, Qc > > > > > > > > > > > > J7B 1M4 > > > > > > > > > > > > T??l.: (450) 971-5478 > > > > > > > > > > > > Cell: (514) 971-2779 > > > > > > > > > > > > Fax: (514) 971-1432 > > > > > > > > > > > > email: yves@(protected) > > > > > > > > > > > > Site Web: www.sol-yd.com > > > > > > > > > > > > > > > > > > > > > > > > ---- > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > > > > To unsubscribe, e-mail: > > > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > > > > For additional commands, e-mail: > > > > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > > > To unsubscribe, e-mail: > > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > > > For additional commands, e-mail: > > > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > > > To unsubscribe, e-mail: > > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > > > For additional commands, e-mail: > > > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > > For additional commands, e-mail: > > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > > For additional commands, e-mail: > > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > > To unsubscribe, e-mail: > > > > log4j-user-unsubscribe@(protected) > > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > > > > For additional commands, e-mail: > > > > log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > > > For additional commands, e-mail: log4j-user-help@(protected) > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > > > For additional commands, e-mail: log4j-user-help@(protected) > > > > > > > > > > > > > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > > For additional commands, e-mail: log4j-user-help@(protected) > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > > For additional commands, e-mail: log4j-user-help@(protected) > > > > > > > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > For additional commands, e-mail: log4j-user-help@(protected) > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > > For additional commands, e-mail: log4j-user-help@(protected) > > > > > > > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > For additional commands, e-mail: log4j-user-help@(protected) > > -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ > To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) > For additional commands, e-mail: log4j-user-help@(protected) > >
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: log4j-user-unsubscribe@(protected) For additional commands, e-mail: log4j-user-help@(protected)
Earn $52 per hosting referral at Lunarpages.
|
|
 |