Saturday, December 29, 2012

Setting Up logentries for OSGi Applications in Apache Karaf

What You'll Get

-->

How To

Get an account at logentries. For a start, you'll get free forever account for 1 GB of logs per month, which is cool. :-)
We need to patch leappender-1-1.5.jar by adding OSGi manifest headers and attach it as fragment to pax-logging-service. (in CentOS/Amazon Linux, jar requires java-1.7.0-openjdk-devel yum package)
wget 'https://github.com/downloads/logentries/le_java/leappender-1.1.5.jar'unzip -d leappender leappender-1.1.5.jarmkdir -vp leappender/META-INF
nano leappender/META-INF/MANIFEST.MF
Replace with:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.logentries.leappender
Bundle-SymbolicName: com.logentries.leappender
Bundle-Version: 1.1.5
Created-By: 1.7.0_09-icedtea (Oracle Corporation)
Export-Package: com.logentries.log4j;uses:="org.apache.log4j.spi";version="1.1.5"
Import-Package: org.apache.log4j,org.apache.log4j.spi
Fragment-Host: org.ops4j.pax.logging.pax-logging-service
rm -v leappender-1.1.5.bar; jar -cvfm leappender-1.1.5.bar leappender/META-INF/MANIFEST.MF -C leappender .
# Wrap it first using bnd
wget -O bnd.jar 'http://search.maven.org/remotecontent?filepath=biz/aQute/bnd/1.50.0/bnd-1.50.0.jar'
java -jar bnd.jar wrap leappender-1.1.5.jar


our appender bundle should be present in the system folder and defined in etc/startup.properties.
The system folder has a “Maven repo like” structure. So you have to copy with:

system/groupId/artifactId/version/artifactId-version.jar


In our example, it means:
mkdir -vp system/com/logentries/leappender/1.1.5/cp -v leappender-1.1.5.bar system/com/logentries/leappender/1.1.5/leappender-1.1.5.jar
and in etc/startup.properties, we define the appender bundle just before the pax-logging-service bundle:
...
org/ops4j/pax/logging/pax-logging-api/1.
7.0/pax-logging-api-1.7.0.jar=8com/logentries/leappender/1.1.5/leappender-1.1.5.jar=8 org/ops4j/pax/logging/pax-logging-service/1.7.0/pax-logging-service-1.7.0.jar=8
...
Edit Karaf's etc/org.ops4j.pax.logging.cfg :
log4j.rootLogger = INFO, out, le, osgi:*
...
# Logentries appender
log4j.appender.
le=com.logentries.log4j.LeAppender
log4j.appender.
le.Token=LOGENTRIES_TOKEN
log4j.appender.
le.Debug=true
log4j.appender.
le.layout=org.apache.log4j.PatternLayout
log4j.appender.
le.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
#
log4j.appender.le.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss ZZZ} %-5p: %F:%L %m
Note: The LOGENTRIES_TOKEN parameter can be found beside the logfile which we created earlier.
I can't get this to work automatically, so on first Karaf launch you'll get ClassNotFoundException, then you'll need to install it:
install mvn:com.logentries/leappender/1.1.5
bundle-level <id> 8
Now it should work.
At first launch you'll get a ClassNotFound exception. Shutdown Karaf and relaunch, it should work. (this was due to the leappender-1.1.5.jar in deploy/ folder, the system one still doesn't work automatically)
Happy logging! :-)
References:

29 comments:

essayswriters said...

Logentries is a nice way to track your server/application logs. Free account available. :)
I blogged this how to at :
http://essayswriters.org/assignment/
Hope this is useful.

www.writemypapers.org said...

It's really one of the best and the easiest ways. Thanks.

special-essays said...

Thanks for useful info!

Buy Essay said...

hey that's really a great post and i like this and thanks for sharing it with us! :)
Writings-centre.com

Kat said...

Information is really useful. Thanks for sharing! Here at http://top-writing-services.com you can also find interesting information.

Amy Pearson said...

Great post! To find more info, follow the link!

alexxlexx said...

Thanks for help, you can find out more at http://prime-essay.org

fitflop uk said...

After basically michael kors outlet out her coach factory assets tiffany and co jewelery in a low-coach factory blazer ensemble, the michael kors outlet reality coach outlet star louis vuitton handbags showed louis vuitton outlet off her coach factory outlet curves in ray ban sunglasses a see-tory burch outlet lace michael kors outlet this oakley sunglasses cheap week. But coach factory outlet worry, she coach store online bra this valentino time. I love coach outlet the louis vuitton outlet minimalist air jordan aesthetic true religion jeans brought to coach factory. He cheap ray ban sunglasses knows that timberland shoes because tory burch spending top prada outlet doesn't true religion outlet mean you coach factory outlet extra coach outlet store online bells <a href="http://www.officialcoachfactoryoutlet.com/"

Amira Taylor said...

The information you shared through your post is functional.I can also advice you express-essays.com

jenny Rocks said...

Need a custom written paper on any subject? No problem! Our writing company will definitely complete it for you. Moreover, our experts use a particular technique to any writing project! Therefore, we offer you to buy your essays at our services.

Inessa Small said...

Interesting post. By the way, students do not have to worry anymore about writing essays. Using first-rate custom essay writing service, that are available 24/7, learners will always get professionally written essays.

BobRobin said...

Student life may be very difficult. If you have some problems with your writing assignments, you can always put your trust in professional writers.

Luca Matrill said...


There are so many students who cannot write essay or they don’t have enough time.I also want to share the tip for getting online writing services that now write best essay without grammar or mistakes by employing online writers for you.

Marilyn Black said...

Most students in schools and tertiary educational background position organizations would commonly want essay help online with regards to their essay jobs would regularly examine internet expert services whereby those people students could purchase them.

Brendon Cooper said...

Just wanted to point you to students who struggle with writing essays. Please take a look and please feel free to make an enquiry without obligation. I might just save you some money in the longer term when you check out the benefits of this essay writing website

Nina Simone said...

Nice article/ My brother would like such information. He is a programmer=) And I am an essay writer. I earn money by essay writing for everyone. And you can look out at this
Address - best-essays-writers.com and find reliable essay sewrvice=)

Frozen Juegos said...

I am very happy to read this. Appreciate your sharing
Signature:
Jugar juego de frozen en lĂ­nea gratis, los nuevos de princesa de Disney juegos frozen - la princesa encantadora y linda. Divertirse frozen!

Facebook Descargar said...

This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something
Signature:
download descargar facebook para android gratis para Android celular and download free facebook descargar and descargar facebook gratis , descarga facebook

Cathy Roberson said...

I recently came across your blog and have been reading along. Nice blog. I will keep visiting this blog very often.

# Writer @ online cheap essay writing service

Tasha Reid said...

Well thanks!I am always searching online for articles that can help me.There is obviously a lot to know about this.Keep working,great job!advanced-writer.com and please welcome to my website.

River Weaver said...

Thankee for this post,it was so useful for me.Also,if somebody feel that writing is a weak point, then go to essays-shark.net where professionals will help you and give you some useful tips.

kitty23 said...

Hi to all! Realy very thanks you for this info!http://www.essay-mania.com visit this essay writing resource and you see how to the students life could be improved!

Clariss said...

Hi friends! You created very good service! Thanks much! Keep on developing your website, I find it very helpful. I know one more helpful wewbsite, if you're interested go to papers-writings.com

Brenda Thomson said...

Thank you for sharing so useful information. It is very helpful during studying process. I also would like to share the great source to get high-quality and original academic papers on any topic academic-writings.com. Enter and enjoy.

Joselin Smitt said...

Thanks for sharing, this post amazing! I also want share with you a link on fantastic site http://essay-professors.com , where I often order assignments for myself!

oakleyses said...

burberry handbags, prada outlet, ray ban sunglasses, gucci handbags, tiffany and co, louis vuitton, christian louboutin outlet, christian louboutin uk, tory burch outlet, ray ban sunglasses, polo ralph lauren outlet online, louis vuitton outlet, jordan shoes, michael kors outlet online, nike air max, christian louboutin, ray ban sunglasses, louis vuitton outlet, longchamp outlet, prada handbags, michael kors outlet online, uggs outlet, christian louboutin shoes, uggs on sale, ugg boots, louis vuitton outlet, chanel handbags, longchamp outlet, oakley sunglasses, nike outlet, louis vuitton, uggs outlet, polo outlet, michael kors outlet, burberry outlet, tiffany jewelry, michael kors outlet online, oakley sunglasses, nike air max, ugg boots, michael kors outlet online, oakley sunglasses, replica watches, nike free, michael kors outlet, replica watches, longchamp outlet, kate spade outlet

oakleyses said...

sac vanessa bruno, hollister uk, polo lacoste, vans pas cher, nike roshe run uk, nike free uk, true religion outlet, air max, polo ralph lauren, coach purses, louboutin pas cher, hollister pas cher, kate spade, lululemon canada, timberland pas cher, michael kors outlet, sac longchamp pas cher, michael kors pas cher, ray ban pas cher, true religion outlet, abercrombie and fitch uk, nike air max uk, replica handbags, nike air max uk, nike blazer pas cher, coach outlet, nike roshe, michael kors, mulberry uk, coach outlet store online, burberry pas cher, guess pas cher, nike air max, sac hermes, michael kors, north face uk, hogan outlet, north face, converse pas cher, oakley pas cher, ralph lauren uk, true religion outlet, new balance, jordan pas cher, nike free run, nike tn, longchamp pas cher, true religion jeans, nike air force, ray ban uk

oakleyses said...

hollister, north face outlet, mac cosmetics, baseball bats, nike huaraches, babyliss, new balance shoes, iphone cases, chi flat iron, louboutin, ferragamo shoes, iphone 5s cases, longchamp uk, soccer shoes, mcm handbags, nike roshe run, timberland boots, mont blanc pens, vans outlet, bottega veneta, instyler, oakley, ralph lauren, valentino shoes, giuseppe zanotti outlet, s6 case, p90x workout, celine handbags, iphone 6s plus cases, herve leger, north face outlet, nike trainers uk, ipad cases, iphone 6s cases, lululemon, wedding dresses, nike air max, abercrombie and fitch, nfl jerseys, hermes belt, insanity workout, ghd hair, asics running shoes, beats by dre, iphone 6 cases, reebok outlet, jimmy choo outlet, soccer jerseys, hollister clothing, iphone 6 plus cases

oakleyses said...

pandora jewelry, canada goose uk, canada goose, barbour, moncler, karen millen uk, swarovski crystal, replica watches, louis vuitton, canada goose, louis vuitton, juicy couture outlet, nike air max, lancel, swarovski, canada goose jackets, gucci, converse, thomas sabo, canada goose outlet, pandora charms, ugg,uggs,uggs canada, juicy couture outlet, doudoune moncler, hollister, moncler, montre pas cher, coach outlet, links of london, hollister, ugg uk, ugg, toms shoes, marc jacobs, pandora uk, vans, canada goose, moncler, canada goose outlet, moncler outlet, moncler outlet, louis vuitton, moncler, ray ban, louis vuitton, louis vuitton, converse outlet, moncler uk, ugg,ugg australia,ugg italia, supra shoes, barbour uk

Post a Comment

 
Copyright 2009 Spring vs Java EE Web Dev. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan