ตัวอย่างการบันทึกข้อมูลของ log ลงใน mysql database โดยใช้ log4j ครับ

สามารถ config ใน file log4j.properties ได้ดังนี้ครับ

log4j.appender.stdout=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.stdout.driver=com.mysql.jdbc.Driver
log4j.appender.stdout.URL=jdbc:mysql://localhost/test
log4j.appender.stdout.user=root
log4j.appender.stdout.password=
log4j.appender.stdout.sql=INSERT INTO keeplog (Message) VALUES ('%d - %c - %p - %m')
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

อธิบายเพิ่มเติม

1.RDBMS คือ mysql

2. database ชื่อ test

3. ต่รางที่เก็บข้อมูลชื่อ keeplog

4. user คือ root ส่วน password ไม่มีครับ

Comment

Comment:

Tweet

chanel bags,http://www.chanelhandbags.net.in/softball bats,http://www.cheap-baseballbats.net/
nfl jerseys,http://www.cheapjerseys.us.org/
nfl jerseys,http://www.cheap-jerseys.us.org/
cheap jordan shoes,http://www.cheap-jordans.net/
michael kors,http://www.cheapmichaelkors.us.org/
nike shoes,http://www.cheap-nike-shoes.net/
oakley sunglasses,http://www.cheapoakley.us.org/
oakley sunglasses,http://www.cheapoakleysunglasses.ar.com/
oakley sunglasses,http://www.cheap-oakleysunglasses.in.net/
ray ban sunglasses,http://www.cheaprayban.com.co/
discount shoes,http://www.cheapshoes.com.co/
uggs outlet,http://www.cheap-uggboots.in.net/
dre beats,http://www.beatsbydrdre.co.com/
beats audio,http://www.beatsbydre.com.co/
beats audio,http://www.beats-by-dre.com.co/
beats audio,http://www.beats-headphone.in.net/
bebe clothing,http://www.bebeclothing.net/
bottega veneta,http://www.bottega.us/
burberry,http://www.burberrycanada.ca/
burberry outlet,http://www.burberry-handbags.us.org/
burberry outlet online,http://www.burberryoutlet.club/
burberry outlet online,http://www.burberryoutlet.me.uk/
burberry outlet,http://www.burberryoutletonline.ar.com/
burberry outlet online,http://www.burberrys-outlet.in.net/
burberry outlet,http://www.burberrys-outletonline.in.net/
calvin klein underwear,http://www.calvinklein.co.com/
celine bags,http://www.celinebags.org/
chanel sunglasses,http://www.chanel-bags.com.co/
polo ralph lauren,http://www.polo-outlets.com.co/
ralph lauren outlet,http://www.poloralphlaurenoutlet.net.co/
prada outlet,http://www.pradahandbags.com.co/
prada outlet,http://www.pradahandbags.net.co/
prada handbags,http://www.pradaoutlet.com.co/
prada outlet,http://www.pradashoes.com.co/
ralph lauren,http://www.ralph-lauren.ca/
ralph lauren,http://www.ralph-lauren.com.au/
ralph lauren uk,http://www.ralph-lauren.org.uk/
ralph lauren outlet,http://www.ralphlaurenepolo.com/
burberry,http://burberry.outletnow.org/
christian louboutin outlet,http://christianlouboutin.outlet-shoes.net/
tory burch sale,http://toryburch.salesandals.net/
abercrombie,http://www.abercrombie-and-fitch.ca/
abercrombie and fitch,http://www.abercrombieand-fitch.com.co/
abercrombie fitch,http://www.abercrombie-and-fitch.us.com/
abercrombie and fitch,http://www.abercrombiefitch.us.com/
abercrombie,http://www.abercrombie-kids.us.com/
adidas,http://www.adidas--canada.ca/
nike huarache,http://www.air-huarache.co.uk/
retro jordans,http://www.airjordans.us/
jordan release dates 2015,http://www.airjordanshoes2015.com/
air max 2014,http://www.airmax-2015.org/
air max,http://www.airmax-90.org/
babyliss pro,http://www.babyliss.us.org/
barbour jackets sale,http://www.barbour-factory.com/
barbour mens jackets,http://www.barbour-jacketsoutlet.com/
basketball shoes,http://www.basketballshoes.com.co/
bcbg max,http://www.bcbgdresses.net/
bcbg max,http://www.bcbg-max-azria.ca/
flat iron,http://www.chiflatiron.net.co/
louboutin,http://www.christian--louboutin.in.net/
louboutin shoes,http://www.christianlouboutin.org.uk/
louboutin outlet,http://www.christianlouboutinoutlet.net.co/
christian louboutin,http://www.christianlouboutinshoes.ar.com/
christian louboutin,http://www.christian-louboutin-shoes.ca/
louboutin shoes,http://www.christianlouboutinshoes.jp.net/
coach factory outlet online,http://www.coachfactory-outlet.co.com/
coach factory outlet,http://www.coachfactory-outlet-online.in.net/
coach purses,http://www.coach-handbags.com.co/
coach outlet,http://www.coachoutlet-online.com.co/
coach outlet,http://www.coachoutletstore.net.co/
coach outlet,http://www.coachoutletstore-online.com.co/
coco chanel,http://www.coco-chanelbags.com.co/
converse shoes,http://www.converse.net.co/
converse,http://www.converses-shoes.net/
handbags outlet,http://www.designerhandbagsoutlet.com.co/
ed hardy,http://www.edhardy.us.org/
glasses online,http://www.eyeglassesonline.us.org/
glasses frames,http://www.eyeglassframes.us.org/
boutique clothing,http://www.fashion-clothing.us.org/
salvatore ferragamo,http://www.ferragamo.com.co/
ferragamo,http://www.ferragamoshoes.net/
straightener,http://www.ghdhairstraightener.com.co/
giuseppe zanotti,http://www.giuseppezanotti.com.co/
gucci handbags,http://www.guccihandbags.net.co/
gucci outlet,http://www.gucci-outlet.biz/
gucci sale,http://www.gucci-outletsale.in.net/
gucci outlet,http://www.guccishoes.com.co/
gucci outlet,http://www.guccishoes.in.net/
gucci outlet,http://www.guccishoes.us.org/
gucci,http://www.gucci-uk.me.uk/
purses and handbags,http://www.handbagsoutlet.com.co/
harrods,http://www.harrods-london.co.uk/
katespade,http://www.kate-spade.net.co/
kate spade,http://www.katespade-outlet.net.co/
levi's jeans,http://www.levisjeans.com.co/