Pages

13 December 2008

Bekerja di rumah

Atas sebab-sebab telah ditetapkanNya, kami telah menjadi host utk acara korban cuti hari Sabtu (dan Ahad) untuk bekerja beramai-ramai.. :p
Sama-samalah kita berdoa, saper-saper yang telah 'ter'masuk umah member tu, dan telah 'ter'ambil notebooknya dan segala hasil kerjanya yang berbulan-bulan, lembutlah hati nya untuk memulangkan notebook tersebut dan segala barang-barang yang 'dipinjam' kepada tuannya semula.. Semuanya dengan izin Allah... Amin...


09 December 2008

eclipse and log4j FileAppender

I have a webapp named 2log4j running on Tomcat 5.5, which requires me to do all logging using Log4j. This is the file structure in eclipse package explorer panel.

From Drop Box

Here are my log4j.properties file and java class that do the logging.

log4j.properties
### direct log messages to stdout ###

#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.Target=System.out

log4j.appender.stdout=org.apache.log4j.RollingFileAppender
log4j.appender.stdout.File=mytestlog.log
log4j.appender.stdout.MaxFileSize=100KB
log4j.appender.stdout.MaxBackupIndex=1

log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=trace, stdout



LogClass.java

package com.zilun.utility;

import org.apache.log4j.Logger;

public class LogClass {
private static Logger log = Logger.getLogger(LogClass.class);

public static void writeLog() {
log.trace("Trace");
log.debug("Debug");
log.info("Info");
log.warn("Warn");
log.error("Error");
log.fatal("Fatal");
}
public static void main(String[] args) {
LogClass.writeLog();
}
}


callLog.jsp
From Drop Box


I found out that the application logs fine to console when run both from class main method and when called from jsp.

When i change the log4j.properties to use either RollingFileAppender or FileAppender it only works if run from class main method.Is there anything that i missed?

i only found out the answer after some times. 4 days to be exact (thats include 3 days hari raya holiday!!). Actually the only thing that i miss is the log file location. ehehe... tak perasan...

I am using eclipse and 2log4j project folder is in c:/eclipse/workspace/
The different is when i run the class main() method, the log file is created in c:/eclipse/workspace/2log4j/ directory but if i call the jsp file callLog.jsp the log file is created directly under eclipse root folder which is c:/eclipse
thats all..

The problem solved! :)

03 December 2008

Sape kata saya tak boleh?...

Lama sungguh tak update.. dekat sebulan dah.. macam biasa, gambar memang banyak.. slalu upload ke picasa, web nyer yang tak update.. tapi ni ngan picasaweb nyer tak update-update.. uhuhu...

Penat.. kerja melambak-lambak.. nape ntah rasa kerja tak abis-abis.. ni tiba mood nak buat kerja kot.. :p tu yang tingat kerja-kerja lama yang tak siap-siap.. uhuhuu..

Satu hari buat kerja.. dapat staff baru semalam.. Dija yang giler express buat kerja.. ahaha.. jenuh nak susun kerja untuk dia.. ntah kalo bagi kerja sebulan, dua tiga hari pun bleh siap.. bagus bagus!..sume orang kene ikut perangai si Dija ni.. (termasuk la yang sedang menulis blog nih.. :p)

Hari ni dah penat.. balik nk surf net.. donlod torrent.. desperate housewife.. ahaha.. baru download S5E03.. dah ketinggalan sungguh.. yg episode one pun tak tengok lagi.. kesian kan?.. tak de life sungguh.. balik umah, angkat kain, lipat baju.. lepas maghrib kuar makan.. sejak pindah umah baru ni, tak masak-masak lagi.. konon lepas pasang kabinet nak rajin masak.. tetiba rasa fridge tak cukup beso plak.. ALASAN!! balik dinner.. memang tak boleh buat apa.. tengok tv.. terlelap depan tv... tu la jadual hari-hari..

tu pun alhamdulillah la tempat kerja dekat 15 minit dah sampai opis.. 8.15 kuar umah.. dekat kul 6 dah sampai umah.. kalo dok kerja tengah2 KL tu... uhuhu.. hari2 nangis agaknyer..

cerita malam ni sebenarnya nak menunjuk skill baru.. orang lain bleh buat.. saper kata kita tak leh buat??.. Enjoy!!

From Experimenting with Photoshop