1
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3) Hibernate: 
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3)     select
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.age_band_age_id as age_band4_5_0_,
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.age_band_age_share_id as age_band1_6_0_,
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.age_band_age_share_id as age_band1_6_1_,
10:52:16,587 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.age_band_age_id as age_band4_6_1_,
10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.is_active as is_activ2_6_1_,
10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.share_amount as share_am3_6_1_,
10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.tier_id as tier_id5_6_1_ 
10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)     from
10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)         eba_age_band_age_share agebandage0_ 
10:52:16,589 INFO  [stdout] (http--0.0.0.0-8080-3)     where
10:52:16,589 INFO  [stdout] (http--0.0.0.0-8080-3)         agebandage0_.age_band_age_id=?

I want to log sql query in following manner :

 10:52:16,588 INFO  [stdout] (http--0.0.0.0-8080-3)
 Hibernate: 
     SELECT
         agebandage0_.age_band_age_id AS age_band4_5_0_,
         agebandage0_.age_band_age_share_id AS age_band1_6_0_,
         agebandage0_.age_band_age_share_id AS age_band1_6_1_,
         agebandage0_.age_band_age_id AS age_band4_6_1_,
         agebandage0_.is_active AS is_activ2_6_1_,
         agebandage0_.share_amount AS share_am3_6_1_,
         agebandage0_.tier_id AS tier_id5_6_1_ 
     FROM
         eba_age_band_age_share agebandage0_ 
     WHERE
         agebandage0_.age_band_age_id=?
Federico Sierra
  • 5,118
  • 2
  • 23
  • 36
kartavya soni
  • 91
  • 1
  • 8

1 Answers1

0

Hibernate query logging writes to stdout, System.out, which is wrapped by a logger in JBoss AS 7. The wrapped stream processes each line separately logging each line separately which is why you see the prefix on each line.

There is no way to turn this off. You could create a logger called stdout and assign a handler to it that doesn't for any formatting. Just give it a pattern of %s%n. That would print each line with no formatting.

James R. Perkins
  • 16,800
  • 44
  • 60