|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Custom ValveHello All!I am trying to edit the AccessLogValve and then would rename it to
some other Valve. Presently, the AccessLogValve writes logs, but I would like to write the same data in an object as well. Any pointers on how can I achieve this ?? I might be able to add some code where it writes to logs, so that it will also write to some object. But then I have no idea how to Deploy this custom valve. Also, Valve Component specifies that the log "pattern" supports many things like %h, %l, etc but so far, i could not find how can I include all those(pattern codes) in the log file. Any help would be great! Thanks all, S |
|
|
Re: Custom Valve-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Sumit, On 6/24/2009 10:48 AM, Sumit D wrote: > Hello All!I am trying to edit the AccessLogValve and then would > rename it to some other Valve. Presently, the AccessLogValve writes > logs, but I would like to write the same data in an object as well. > Any pointers on how can I achieve this ?? I might be able to add some > code where it writes to logs, so that it will also write to some > object. What do you mean when you say "write some data in an object"? > But then I have no idea how to Deploy this custom valve. Deploying the valve is easy: 1. Compile it to .class file(s) 2. JAR your .class files into a .jar file 3. Put your .jar file into $CATALINA_HOME/lib 4. Add a <Valve className="my.Valve"> element to your <Context> element in META-INF/context.xml in your webapp > Also, Valve Component specifies that the log "pattern" supports many > things like %h, %l, etc but so far, i could not find how can I > include all those(pattern codes) in the log file. You'll just have to read the code. Start with the "createLogElements" method and read everything it calls. It's pretty straightforward. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpCnQYACgkQ9CaO5/Lv0PA0nQCfZI5xk3HHQTPMTQCQGdckX6Y7 a7gAn0gSUe1mAmtVQmM5N8JNzaovpUny =68qu -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Custom ValveHi Christopher*
* Thank you for your response. *By "write some data in an object" I wanted to say that, when the logs are written, * *then and there I would like to have the same information encapsulated in an object* because we need to send it to our framework. Another option would be analyzing the logs and extracting the info. But I thought it might be a bit easier to get it in some object. I will either modify the AccessValveLog class or just extend it to meet our requirements. by the way, I could not find META-INF/context.xml. I create from scratch ? Also, if I put the <Valve className="my.Valve">...........code in the server.xml of Tomcat, would'nt it work just like AccessLogValve ?? Thanks once again, Cheers * * On Wed, Jun 24, 2009 at 11:39 PM, Christopher Schultz < chris@...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Sumit, > > On 6/24/2009 10:48 AM, Sumit D wrote: > > Hello All!I am trying to edit the AccessLogValve and then would > > rename it to some other Valve. Presently, the AccessLogValve writes > > logs, but I would like to write the same data in an object as well. > > Any pointers on how can I achieve this ?? I might be able to add some > > code where it writes to logs, so that it will also write to some > > object. > > What do you mean when you say "write some data in an object"? > > > But then I have no idea how to Deploy this custom valve. > > Deploying the valve is easy: > > 1. Compile it to .class file(s) > 2. JAR your .class files into a .jar file > 3. Put your .jar file into $CATALINA_HOME/lib > 4. Add a <Valve className="my.Valve"> element to your <Context> > element in META-INF/context.xml in your webapp > > > Also, Valve Component specifies that the log "pattern" supports many > > things like %h, %l, etc but so far, i could not find how can I > > include all those(pattern codes) in the log file. > > You'll just have to read the code. Start with the "createLogElements" > method and read everything it calls. It's pretty straightforward. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkpCnQYACgkQ9CaO5/Lv0PA0nQCfZI5xk3HHQTPMTQCQGdckX6Y7 > a7gAn0gSUe1mAmtVQmM5N8JNzaovpUny > =68qu > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
|
|
RE: Custom Valve> From: Sumit D [mailto:sumitd.10@...]
> Subject: Re: Custom Valve > > by the way, I could not find META-INF/context.xml. I create from > scratch ? Yes, create it if you need one. Many webapps do not require the Tomcat-specific settings available via a <Context> element. > Also, if I put the <Valve className="my.Valve">...........code in the > server.xml of Tomcat, would'nt it work just like AccessLogValve ?? Yes, but it will apply to all sub-components of where you put the <Valve>. Placing it inside the <Context> element in the META-INF/context.xml file keeps it from affecting other webapps. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Custom Valve-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Sumit, On 6/25/2009 7:42 AM, Sumit D wrote: > *By "write some data in an object" I wanted to say that, when the logs are > written, * > *then and there I would like to have the same information encapsulated in an > object* > because we need to send it to our framework. > > Another option would be analyzing > the logs and extracting the info. But I thought it might be a bit easier to > get it in > some object. Okay. So, define some object that meets your needs, and write the log message not only to the log file, but also "to" your object (whatever that means: queuing a string, etc.). Stick the object in either the request (if the scope of this info ought to be the request) or stick it in the ServletContext. Do you want us to give you some ideas? This sounds like it's pretty straightforward. Many of us get paid for our software work... See Chuck's responses re:context.xml and <Valve> configuration. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpEz6oACgkQ9CaO5/Lv0PCEXgCglFVsnckUCkzBDpMDrlOFXH5t KPgAn1TSPNC+TohJ/uqgEWEabBQKEbw0 =pa7F -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Custom ValveThank you Chris and Chuck for your replies.
I tried to write a Custom Valve but please correct me if I am wrong: when writing a custom valve, - Extend the ValveBase class, Implement LifeCycle (not obligatory) - write invoke method implementation - compile and create its .jar file and put it in Catalina_Home/lib - point it using the context.xml or server.xml (depending on the choice at what lever to implement the Valve) Please correct me if anythings going wrong here. @ Chris, Sorry but i dont quite understand what you meant by "Many of us get paid for our software work..." If you could give more pointers, that would be great. Since I am on short internship, I can try out a lot of things Or if you can give me a really basic idea to write a very basic Valve , that would be great. I will keep you updated if anything works out... Thank you so much, Cheers Sumit On Fri, Jun 26, 2009 at 3:39 PM, Christopher Schultz < chris@...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Sumit, > > On 6/25/2009 7:42 AM, Sumit D wrote: > > *By "write some data in an object" I wanted to say that, when the logs > are > > written, * > > *then and there I would like to have the same information encapsulated in > an > > object* > > because we need to send it to our framework. > > > > Another option would be analyzing > > the logs and extracting the info. But I thought it might be a bit easier > to > > get it in > > some object. > > Okay. So, define some object that meets your needs, and write the log > message not only to the log file, but also "to" your object (whatever > that means: queuing a string, etc.). Stick the object in either the > request (if the scope of this info ought to be the request) or stick it > in the ServletContext. > > Do you want us to give you some ideas? This sounds like it's pretty > straightforward. Many of us get paid for our software work... > > See Chuck's responses re:context.xml and <Valve> configuration. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkpEz6oACgkQ9CaO5/Lv0PCEXgCglFVsnckUCkzBDpMDrlOFXH5t > KPgAn1TSPNC+TohJ/uqgEWEabBQKEbw0 > =pa7F > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
|
|
Re: Custom Valve-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Sumit, On 7/1/2009 4:02 AM, Sumit D wrote: > - Extend the ValveBase class, Implement LifeCycle (not obligatory) > - write invoke method implementation > - compile and create its .jar file and put it in Catalina_Home/lib > - point it using the context.xml or server.xml (depending on the choice at > what [level] to implement the Valve) All looks correct. > @ Chris, Sorry but i dont quite understand what you meant by "Many of us get > paid for our software work..." I meant that nobody on this list is going to write your software for you unless you pay them. You can get help and tips, and maybe some working code, but at some point, you're going to have to do the work yourself. > Or if you can give me a really basic idea to write a very basic Valve , that > would be great. The Valve code is easy (and you probably already have it written, compiled, and working). The hard part is designing the logging component that you mentioned in your original post. This is what I meant by "you're going to have to do the work yourself": you need to design your own "logging object" that consumes log messages and does something with them. We have no idea what that component should do and how it fits into your architecture. You seem to be asking for help to do something that is very unclear. I can think of many ways to write logging statements to files/databases/syslog/whatever but you've not really asked a specific question. You have basically asked "I want to write a logging valve, and I thought I'd start by extending AccessLogValve. Anyone have any ideas?!". This is not a very directed question. You aren't going to get very directed feedback (at least not from me). Posting your code would help. Describing what you think you might want to do with your code would help. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkpLWAEACgkQ9CaO5/Lv0PC+oACgr0Kt7m0OpYapM6wiSlztf8i5 lToAn05E/obNNHvp+99OBdqIHvG22oMN =2CcI -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@... For additional commands, e-mail: users-help@... |
|
|
Re: Custom ValveHey Chris,
Thanks a lot for the detailed reply. At the moment, I have written a class that extends AccessLogValve.java. I deactivated the AccessLogValve from the server.xml and <Valve className="my.Valve"> element to your <Engine> for this new Extended Valve.(We wanted it at Engine level.) Works completely fine! Thanks for the clarification :) Its just that I had no idea about this component when I started the internship. Since I dont have a lot of time, I prefered to get some help on this list.(Which I got! More than Enough actually) I thank you and Chuck for that. hats off! honestly. I just needed to create a simple Valve and see how to deploy it. (Like a prototype to test what can be possible if we use the Valve component.)It was pretty easy once I actually understood how to do it. Now I just need to call an event and mount this "monitored info" Thanks once again, S On Wed, Jul 1, 2009 at 2:35 PM, Christopher Schultz < chris@...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Sumit, > > On 7/1/2009 4:02 AM, Sumit D wrote: > > - Extend the ValveBase class, Implement LifeCycle (not obligatory) > > - write invoke method implementation > > - compile and create its .jar file and put it in Catalina_Home/lib > > - point it using the context.xml or server.xml (depending on the choice > at > > what [level] to implement the Valve) > > All looks correct. > > > @ Chris, Sorry but i dont quite understand what you meant by "Many of us > get > > paid for our software work..." > > I meant that nobody on this list is going to write your software for you > unless you pay them. You can get help and tips, and maybe some working > code, but at some point, you're going to have to do the work yourself. > > > Or if you can give me a really basic idea to write a very basic Valve , > that > > would be great. > > The Valve code is easy (and you probably already have it written, > compiled, and working). The hard part is designing the logging component > that you mentioned in your original post. This is what I meant by > "you're going to have to do the work yourself": you need to design your > own "logging object" that consumes log messages and does something with > them. We have no idea what that component should do and how it fits into > your architecture. > > You seem to be asking for help to do something that is very unclear. I > can think of many ways to write logging statements to > files/databases/syslog/whatever but you've not really asked a specific > question. > > You have basically asked "I want to write a logging valve, and I thought > I'd start by extending AccessLogValve. Anyone have any ideas?!". This is > not a very directed question. You aren't going to get very directed > feedback (at least not from me). > > Posting your code would help. Describing what you think you might want > to do with your code would help. > > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkpLWAEACgkQ9CaO5/Lv0PC+oACgr0Kt7m0OpYapM6wiSlztf8i5 > lToAn05E/obNNHvp+99OBdqIHvG22oMN > =2CcI > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@... > For additional commands, e-mail: users-help@... > > |
| Free embeddable forum powered by Nabble | Forum Help |