I’m going to sneak in a bonus blog post in the Enterprise OSGi series as I think some people may have had issues in getting the last step to work and will be relatively stuck without a little help in debugging what the heck is going on with Spring DM Extender. Enabling logging on a bundle that you did not write may seem tricky. Some may even attempt to download the source, tweak it and re-bundle the extender. A cool feature of OSGi is the ability to extend bundles that you’ve not written by developing a Fragment. Fragments allow bundles to be closed for modification, but open for extension. They are typically used to customize web bundles with separate UI skins (as we’ll see later), internationalization, separate OS installations, and a few other niche cases. In our case, we’ll leverage a fragment to customize the log level of the dm extender so that we can figure out what is going on when say, our bundle doesn’t start and there are absolutely zero messages explaining why. Let’s get started by creating another bundle
I passed another couple of flags to maven on this command to ensure that it doesn’t create any internal or interface classes that we’ll have to delete. In our simple case of enabling some logging, we really only need to add a single log4j.properties file to get the magic to happen. I placed it in a src/main/resources/ to keep in line with a typical maven project and added some simple verbose logging configuration.
log4j.rootLogger=info, A
log4j.appender.A=org.apache.log4j.ConsoleAppender
log4j.appender.A.layout=org.apache.log4j.PatternLayout
log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
The last order of business is to adjust the manifest to attach this fragment to a host bundle. As usual, we accomplish this task by adding the following line to the BND file
Fragment-Host: com.springsource.org.apache.log4j
Compiling the project and running pax-provision should provide a slew of information regarding the process spring uses to look for bundles and resolve dependencies
If you’ve had issues, this will hopefully provide some clues as to why the dm extender was not able to find your dependencies. My most frequent mistake is to misspell the directory containing the context files. In the next post, we’ll resume our regularly scheduled programming by providing a database backed persistence layer in our application.
Examples, as always available on github.

37 comments:
上來打聲招呼,祝你一切平安!........................................
人要學習健忘,把所有不如意忘掉,才會快樂。..................................................
從人生中拿走友誼,猶如從生活中移走陽光........................................
may the blessing be with you.........................................
我愛那些使自己的德行成為自己的目標或命定的人........................................
脾氣與嘴巴不好,就算心地再好,也不算好人~~~..................................................
I love readding, and thanks for your artical. ........................................
朝著既定的目標走,就不會迷失。........................................
成人免費線上 免費視訊影音 一夜情色聊天室 免費h卡通影片 男男交友網 女優影城 無碼性感影片 亞洲東影片 極限情色偷拍貼圖 即時聊天室 小弟弟愛愛網 情趣用品 18禁的影片 少女辣妹 都都成人影城 線上a片免費 情色自拍貼圖區 麗色情遊戲 一夜情綱站 383影音 ut完美 玩美女人視訊 美女色情 脫衣秀 人妻自拍露點 熟女 免費a片 a片下載 a圖網情色交流論壇 女優寫真 /85cc 杜蕾斯貼圖區微風成人 嘟嘟 免費視訊 熊貓貼圖區 援交 情人視訊網d760 鋼管辣妹秀 av電話下載 洪爺性感影片貼影片 大奶護士 情色a片 情色免費下載 日本巨乳寫真 性愛聊天室 後宮 限制級 0204 性愛圖 洪爺自拍走光照片
尼采:「一棵樹要長得更高,接受更多的光明,那麼它的根就必須更深入黑暗。」 ....................................................
the food is delicious!............................................................
生活盡可低,志氣當高潔..............................
失去金錢的人,失去很多;失去朋友的人,失去更多;失去信心的人,失去所有。.................................................................
You are flattering me..................................................
一棵樹除非在春天開了花,否則難望在秋天結果。....................................................................
幸福不是一切,人還有責任。....................................................................
累死了…來去看看文章轉換心情~.................................................................
成熟,就是有能力適應生活中的模糊。.................................................................
當一個人內心能容納兩樣相互衝突的東西,這個人便開始變得有價值了。............................................................
每次看完你的文章,總是回味許久,要經常發表喔。..................................................................
很棒的分享~留言支持!.......................................................
要經常發表文章 最愛你了呦..................................................
蛛絲馬跡皆學問、落花水面皆文章............................................................
工作,是愛的具體化~~~~努力吧!............................................................
happy to read~ thank you!..................................................................
缺少智慧,就是缺少一切..................................................
Habit is a second nature...................................................
閱讀您的BLOG文章,真是件快樂的事!!.................................................................
人生中最好的禮物就是屬於自己的一部份............................................................
人生中最好的禮物就是屬於自己的一部份..................................................
幸福不是一切,人還有責任。............................................................
做些小善事,說些愛的字句,世界更快樂。..................................................
真正仁慈的人,會忘記他們做過的善行,他們全心投入現在的工作,過去的事已被遺忘。.................................................
河水永遠是相同的,可是每一剎那又都是新的。..................................................
河水永遠是相同的,可是每一剎那又都是新的。............................................................
Never put off till tomorrow what may be done today..................................................................
加油!!! 很棒的分享~. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Post a Comment