Java comes in with a handy logging package (java.util.logging) which eliminates the need to use external logging packages like Log4J.�W�����ɂ́A�֗��ȃ��M���O�p�b�P�[�W�i java.util.logging �j���O�t������K�v���Ȃ��Ȃ�܂����O�p�b�P�[�W���g�p����悤��Log4J�̂ł��B However it still requires some configuration which makes it cumbersome and repetitive to include in every class.����������ł��A�����‚��̐ݒ�����邱�Ƃ��K�v�ƔώG�ȌJ��Ԃ��Ɋ܂߂�ɂ͂��ׂẴN���X�ł��B You need to choose your Logger, name it, instantiate it etc.����K�v������܂��B���K�[��I�����Ă��������A���O�ɂ́A���ꓙ�̃C���X�^���X

I like simple solutions.���̂悤�ȃV���v���ȃ\�����[�V�����ł��B Here is a super simple way to easily use java.logging for your logging needs.���Ɏ����̂́A���ȒP�ȕ�@���ȒP�Ɏg�p���ă��O�̃j�[�Y��java.log���߂ł��B

You can also use this solution to easily convert all your System.out.println to use java.logging, which provides more information (calling method name, time etc.), granularity and control.���̃\�����[�V�������g�p���邱�Ƃ��A���ׂĂ�system.out.println���ȒP�ɕϊ������java.log���g�p���A���̏���񋟂���i�Ăяo�����\�b�h�̖��O�A���ԓ��j �A���x����ѐ��䂵�܂��B

This solution is applicable to JDK 1.5 and beyond only, uses static import.���̉����􂪓K�p������JDK 1.5�ȍ~�̂݁A�g�p���ĐÓI�ɃC���|�[�g���܂��B

First include the following line on top of all your Java source files (after package statement, if any):���ɂ́A���̍s�̏�ɁA���ׂĂ�Java�\�[�X�t�@�C���i�p�b�P�[�W�X�e�[�g�����g��������A��������΁j �F
import static java.util.logging.Logger.global; �C���|�[�g�̐ÓIjava.util.logging.logger.global ;

This makes the global Logger methods available in your code.����ɂ��A�O���[�o���ȃ��K�[�̃��\�b�h�̃R�[�h�ŗ��p�”\�ł��B So now you can easily log messages like:���������āA���̂悤�ȃ��O���b�Z�[�W���ȒP�ɂ��邱�Ƃ��ł��܂��F
global.severe("This is a severe error"); global.severe �i "����͐[���ȃG���[������" �j ;

global.info("This is information only"); global.info �i "����͏��̂�" �j ;

You can log exceptions with:���O�̗�O�Ƃ��邱�Ƃ��ł��܂��F
public void throwing(String sourceClass, String sourceMethod, Throwable thrown) ���������i������sourceclass �A������sourcemethod �A Throwable�̃X���[�j

In short all the methods of java.util.logging.Logger are available to you, even from static methods and static context.�[�I��java.util.logging.logger�̂��ׂẴ��\�b�h�𗘗p�ł���悤�ɂ���̂��A�ÓI���\�b�h�ƐÓI�ȃR���e�L�X�g����ł��B

Note: Unfortunately you cannot make it even shorter like simply invoking severe() or info().���F�c�O�Ȃ���Z�����邱�Ƃ͂ł��܂���̂悤�ȒP���ɋN�����邱�Ƃ��d�x�́i �j����������ƌ���i �j �B However you can shorten the name to say l and use l.severe().���������邱�Ƃ��ł��܂��B�Z������̖��O�������Ă�邪L�Ǝg�pl.severe �i �j �B This requires declaring a static Logger variable named l which is instantiated with global;���̐ÓI�ȃ��K�[��錾����K�v���C���X�^���X�ϐ��̖��O�̍��O���[�o��;

I am extensively using this approach for simple logging needs in my projects.���͂��̃A�v���[�`���L�͈͂Ɏg�p���ĊȒP�ȃ��O�̃j�[�Y�Ɏ��̃v���W�F�N�g�ł��B