You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Karen Goh <ka...@yahoo.com.INVALID> on 2018/01/29 16:29:23 UTC

what is wrong with my logging such that Eclipse is not printing the logging in the console ?

Hi experts,

I have this log4j2 problem for quite so time now and hope that I can get some tips off this group where about I have done things wrongly.

Here is below my log4j2.xml which I put it in a Resource folder at my Project in Eclipse NEON.

<Configuration>
	<Appenders>

		<!-- Console Appender -->
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout
				pattern="%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %msg%n" />
		</Console>

	</Appenders>
	<Loggers>
	        <Logger name="Business.RegisterService" level="info" additivity="false">
            <appender-ref ref="Console" level="info"/>
        </Logger>
    
		<!-- Log everything in hibernate -->
		<Logger name="org.hibernate" level="info" additivity="false">
			<AppenderRef ref="Console" />
		</Logger>

		<!-- Log SQL statements -->
		<Logger name="org.hibernate.SQL" level="debug" additivity="false">
			<AppenderRef ref="Console" />
		</Logger>
		<!-- Log JDBC bind parameters -->
		<Logger name="org.hibernate.type.descriptor.sql" level="trace"
			additivity="false">
			<AppenderRef ref="Console" />
		</Logger>
		<!-- Log custom packages -->
		<Logger name="util" level="debug" additivity="false">
			<AppenderRef ref="Console" />
			</Logger>
		<Root level="debug">
			<AppenderRef ref="Console" />			
		</Root>
	</Loggers>
</Configuration>

Abit about my project : dynamic annotation Java EE with hibernate and JPA.

I have also added log4j-api-2.10.0-source.jar and log4j-core-2.10.0-sources.jar in the build path.  It is also in my m2 repository via maven.

And in one of my classes, I have put in the necessary code ;

public class tutorDAOImpl implements tutorDAO {

	private static final Logger log = LogManager.getLogger(tutorDAOImpl.class );
....
m.subjMany(m.getSubjects());
			session.saveOrUpdate(m);
			tx.commit();
			log.info("Tutor object saved");
			session.close();
			System.out.println("added");
			}catch(Exception e){
				log.warn("SEVERE problem cleaning up: " + e.getMessage());

All I get is Tomcat 'log':

INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Jan 30, 2018 12:24:09 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 12616 ms


I felt that I have all the things in place for the logging to be shown when I run debug server...but no logging Infor is shown.

Furthermore, I used to be able to get this Hibernate logging shown the SQL infor etc as the debugger step thru the programme.

Hope someone can tell me what have I forgotten to do or what has caused the console not to show any logging details.

Thanks alot in advance.

regards,
Karen


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org