Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8871283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:57:14+00:00 2026-06-14T17:57:14+00:00

I would like to control the logging by configuring log level in logger.xml. I

  • 0

I would like to control the logging by configuring log level in logger.xml.

I used play.Logger with level ERROR set in logger.xml but logger with level INFO, DEBGU are also getting logged.

I have used ALogger log = play.Logger.of(Application.class); with INFO level in logger.xml but only error logs are getting logged.

I tried creating the custom logger class also by having custom methods for info and debug but it didn’t work out.

I have not found any solution in any of the forum/community pages. Please guide me how to proceed further.

Below is the code & also the logger.xml

package test

import play.mvc.Controller;
import play.mvc.Result;
import views.html.index;

public class Application extends Controller {

    public static Result index() {
        return ok(index.render("Rendering "));
    }

    public static Result ourApp() {
        ALogger log = play.Logger.of(Application.class);
        log.info("**** Info enabled *****");
        log.debug("**** debug enabled *****");
        log.error("**** error enabled *****");
        if(log.isDebugEnabled())
        {
            log.debug("**** Debug enabled *****");
        }
        if(log.isInfoEnabled())
        {
            log.info("**** Info enabled *****");
        }
        if(log.isErrorEnabled())
        {
            log.error("**** Error enabled *****");
        }
        return ok();
    }

    public static Result getXPage(String patId) {
        String xValue = TestDao.getXNotes(patId);
        return ok(test.render(Value));
    }
} 

logger.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />

  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
     <file>${application.home}/logs/app.log</file>
     <encoder>
       <pattern>%date - [%level] - from %logger %n%message%n%xException%n</pattern>
     </encoder>
   </appender>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">

    <encoder>
      <pattern>%date - [%level] - %logger{15} - %message%n%xException{5}</pattern>
    </encoder>
  </appender>

    <logger name="play" level="INFO" />
    <logger name="application" level="INFO" />

   <root level="ERROR">
    <appender-ref ref="STDOUT" />
    <appender-ref ref="FILE" />
  </root>
</configuration>

Output:-

2012-11-22 19:05:43,920 - [INFO] - from play 
Application started (Dev)

2012-11-22 19:05:44,127 - [ERROR] - from test.Application 
**** error enabled *****
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:57:15+00:00Added an answer on June 14, 2026 at 5:57 pm

    Try using the logger name instead of the Class name

    ALogger log = play.Logger.of("application");
    

    This wokrs fine. Also comment out the lines that mention the log level in the file application.conf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to bind C-` (control-backquote) but I could not do it. The
I would like to control and embed my send() calls in a try/except, but
I would like to control which methods appear when a user uses tab-completion on
We have a video (13 minutes long) which we would like to control using
Given the following html table, I would like to control the width of the
Would like to know how to integarate cruise control with maven? Cruise Control comes
I would like to place an edit control (WC_EDIT) on a static control (WC_STATIC).
I would like to create a custom control in order to display a pie
I would like to bind a TreeView control I have defined in XAML to
I would like to create a custom control in my Android App. It will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.