Java Logigng, Custom FileHandler level problem.

Dears,
I would like to use java builin logigng facility, but the problem is that it is not providing the facility of daily file rolling in FIleHandler as log4J is providing the facility in DailyRollingFileAppender
I found the custom File handler form the following thread:
http://forum.java.sun.com/thread.jspa?forumID=256&threadID=421131
But the problem is that now I cannot able to change the logger level at runtime using
Logger.setLevel() or using JMX Mbeans exposed by java.util.logging.
I was able to change the loglevel when I was using java.util.logging.FileHandler
I found that level setting is done at Logger also at handler level.
So how can I handle this?
I want to log file on daily basis + also want to provide facility to change level using JMX.
thanks.

Okay, I figured out my problem, but I'm not sure how much it's going to help you. My problem was the same as yours (I just didn't know it). It had nothing to do with multiple threads, but had to do with the fact that I was reinitializing the LogManager multiple times (I have the init in a static class that multiple classes use and didn't realize the number of times it was getting called).
Now, I do have a possible suggestion for changing handlers, if you're okay doing it inside code (instead of using a config file). Technically, you could creat your own config file and change some stuff.
Anyway, here's what I do to change handlers:
private static Logger logger = Logger.getLogger(Archive.class.getName());
(in function)
try {
    logger.removeHandler(reportArchiveHandler);
} catch (NullPointerException e) {
    // ignore
reportArchiveHandler = new FileHandler(this.getCurrentLogDir() + "/log.txt", 50000, 1, true);
reportArchiveHandler.setLevel(Level.INFO);
reportArchiveHandler.setFormatter(new AuditFormatter());
logger.addHandler(reportArchiveHandler);
LogManager.getLogManager().addLogger(logger);
}That changes the handler and doesn't create any new files. The only problem is you can't just read a new config file.
Hope that helps a little,
Mike

Similar Messages

  • Getting no output from java.util.logging.FileHandler

    I am new to Java as is the company I work for, but we have just landed a contract that specifies J2EE as the platform, so here we are. :-) Please bear with me.
    I have been charged with determining our logging architecture and it looks like what is available in java.util.logging will do well (though we may use log4j). However, at this point I am just trying to get anything to work and not having much luck.
    We are using JSF on the front end and I have created a very simple JSF page to test logging. The relevant code is below and I hope will be self explanatory: This code is not meant to be efficient or anything. It is just a proof of concept.
        public String button1_action() {
            // User event code here...
            try {
                Logger l = java.util.logging.Logger.getLogger(Page1.class.getName());
                l.entering(Page1.class.getName(), "button1_action");
                l.info(this.textField1.getValue().toString());
                l.exiting(Page1.class.getName(), "button1_action");
                java.util.logging.Handler h = l.getHandlers()[0];
                h.flush();
            catch(Exception ex) {
                //I have tested this and we aren?t catching any errors.
                System.err.println(ex);
            return "";
        }My logger.properties files looks like this:
    handlers= java.util.logging.FileHandler
    .level= FINEST
    java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatterI have developed and tested this in Sun Studio Creator 2004Q2 What is happening is that I am getting three log files in c:/sun/logs
    test-0.log, test-1.log and test-2.log. The first two contain output from various sun components. (sun.rmi.transport for example). The third log remains empty. (zero length)
    I have also deployed the test app to a tomcat 5.0.28 server and get similar results. The only difference is I get only one two log files and the second one remains empty.
    Any assistance or suggestions as to what direction I should be taking would be appreciated.
    --Ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Do not use default logger as getLoggers[0] , but use your java.util.Logger.FileHandler and add filehandler object to log your fButtonActions and you do not need to mess with logger.properties too.

  • IViews are not updated in customized top level navigation

    Hi experts,
    I am working on External Facing Portal. I developed customized top level navigation. The problem is that the content area of External Facing portal is not refreshed. Although, i can see different navigationURLs but content area iView remains same. For testing purpose, i assigned role (which i created for anonymous access) to a new portal user. All pages/ivews/ for that role are working fine and content area is also updated when i click on different navigation. Remember that is standard portal not anonymous. It means through myserver:50100/irj/protal?NavigationTarget=navurl://cb0c473832f39033f88904647de63252 all navigation is working fine including content area but when i access External Facing Portal through  myserver:50100/irj/protal/anonymous?NavigationTarget=navurl://cb0c473832f39033f88904647de63252 navigationURLs is updated but the content area remains same. Content area contains 1 page and page itself contains 1 iVew. I assigned that light page to Light Framework page.
    Do i need to implement navigation connectors for that issue or i miss something?
    waiting for your response.
    regards
    Abbas

    Have you tried disabling the iView caching (check the iView and page properties). Your browser and proxy server (as you mention it is external facing) may also be caching the content, hence the reason when you use your user ID and the Java restart occurs everything is reset correctly.
    I know when doing Visual Composer developments that SAP EP caches the Function Module interfaces and that in the development environment I needed to change parameters in Visual Admin for the VC component lifetime to handle these. It could well be that you are referencing components that have lifetime keep alive set for them in the environment too. Refer to the API / SDK documentation if you suspect this could be the case for you too.
    What exactly is the iView in the content area doing? Is it just a transactional iView or is it a custom iview?
    If you can perhaps try putting on an http trace or monitor the NWA logs to determine if any issues exist. You Java VM may also require some more fine tuning in the external facing scenario - the GC may not be collecting items efficiently.

  • Allocations at customer Hierarchy level

    Hi Gurus,
    I have a requirement from client to allocate stock of restricted products at customer hierarchy level. For example: Material ABC is a restricted product and there are 500 CV available in the plant, Client would like to allocate 100 CV to customer-1, 200 CV to customer-2 and 200 CV to customer-3.
    Also Material ABC can be allocated to one of the nodes of customer hierarchy and automatically this stock should be available to all the customers with in that hierarchy to consume. If there is a chain customer like SAMS, stock is assigned to highest node of SAMS at state level and this stock should be available for all SAMS clubs with in the state to consume.
    I am using Quotations to reserve stock at customer level. The problem is with allocating stock at customer hierarchy level. Please suggest me some solutions to achieve this requirement.
    Thank You in advance,
    Samatha.
    Edited by: Samatha on Oct 11, 2011 10:04 PM

    Hi,
    That particular product and customer groups combination cvcs delete. It means that the particular combination of cvcs deleted. so there is no chance to  see the forecast.
    regards,
    sivaram2411
    Edited by: sivaram2411 on Apr 19, 2011 9:03 AM

  • Custom Permission Level Contribute No Delete not working

    I have created a custom permission level that is the same as OOTB Contribute, except it doesn't have the Delete Items nor Delete Versions.
    In my document libraries, I have "require documents to be checked out" set to Yes.
    This is causing some strange behaviour.  When a user (that has my custom Contribute No Delete permission) tries to open a document for editing, they get a message that the document is checked out to their own username, and it won't allow
    them to edit the document.
    What is the best way to remove the "Delete" permission?  We absolutely need this.
    thanks!

    Are you given an option to check it back in via the "back-stage" area? 
    I'd also say that the highest permission grouping wins.  If one group grants a right and another removes it, the additive grouping will win out.  As well as checking the inheritance, it's ideal to remove permissions that might grant this.
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Change Custom Access Level on a personal folder

    Hi All,
    This is about Business Objects XI 3.x
    I'm looking for a solution to change the security settings on a personal folder.
    Within 3.x it isn't possible to "overide"  the user settings on a personal folder with the use of an usergroup.
    So what I'm looking for is a way to overide the user settings Access level (by default this is Full Controll) with a custom Access level so I can take away some privilige on the personal folder.
    Is there a Java script allready be developed by some one that I can use?
    Thanks in advance.
    Cheers,
    Jan

    Hi Jan,
    You can use the following code snippet:
    // folders is IInfoObjexts collection that contains the personal folders.
    folders = oInfoStore.query(query);
              if (folders.size() > 0)
    // query for the user for whom you want to set custom access role over the personal folder.
    query = "select * from ci_systemobjects where si_name ='" + testUser + "' and si_kind ='user'";
    users = oInfoStore.query(query);
    // set the custom role.
    folder = (IInfoObject) folders.get(0);
    user = (IInfoObject) users.get(0);
    IExplicitPrincipals explicitPrincipals = folder.getSecurityInfo2().newExplicitPrincipals();
    IExplicitPrincipal explicitPrincipal = explicitPrincipals.add(user.getID());
    // customRoleID is SI_ID of te custom role. You can retrieve custom role just as you retrieve any other
    //info objet. You can use the query like : select * from ci_systemobjects where si_name='custom role
    //name' and si_kind='customrole'
    IExplicitRole explicitRole = explicitPrincipal.getRoles().add(customRoleID);
    oInfoStore.commit(folders);                         
    I hope this helps.
    Thanks
    Aasavari               }

  • Can java be a low level programming language??*

    can java be a low level programming language??
    can anyone answer this question and explain it why?
    please please please...�
    [email protected]

    strike one: you are asking an obvious homework type program without showing any evidence of having done any work of your own first. Please show your work first. This isn't a homework service.
    strike two: you are cross posting here and in the "new to java forum". This irritates many of us to no end as we end up doing volunteer work to solve a problem only to find that its already been solved in another thread. So we've wasted our time for nothing. Don't do this.

  • Using log4j to create custom log level in standalone batch application

    Hi all,
    I would like to use Log4j to create a custom log level so that from my standalone java batch process application, whatever error messages I can log to a log file.
    Can any one give me any pointer on this.
    Appreciate any help.

    This doesn't seem to warrant a 'custom level'. Just use Log4J as is... create a Logger object and use its error() or warn() or whatever methods are appropriate for the logging you want to do. I don't understand the reason for the question.

  • Java has no function level lock?

    Hi, everyone!
    I am a C++ programmer before and after reading the
    internal implemention method of Java Thread. I think
    Java has no function level lock and only object level
    lock. I mean to acquire a function lock is the same as
    acquire an object's lock.
    For example, when objectA.synchronizedFunctionA is called,
    suppose synchronizedFunctionA is a synchronized function of
    class A. Java only check whether objectA is locked. The synchronized
    function synchronizedFunctionA has no individual function level
    lock.
    Am I correct?
    If I am correct, I think in some certain application, function level
    lock will be more efficient than object level lock. Even though it
    should be used more carefully.
    Thanks in advance,
    George

    You could have a custom lock object for every method to get the same functionality.
    I.e. instead of...
    public synchronized void mySynchMethod() {
    }you'd do..
    public void mySynchMethod() {
       synchronize(thisMethodLock) {
    }where thisMethodLock would be some object used as a lock by only that method.

  • Export Rights from Custom Access Level to Excel

    How can I export the rights from Custom Access Levels to Excel? Thanks.

    Hi Nancy,
    Is this what you're looking for:
    1522,Custom Access Level 1,/Custom Roles/Custom Access Level 1,CustomRole,General,General,Add objects to folders that the user owns,Not Specified,Object and Subobjects,
    This is the comma delimited output from a Security Query executed in the CMC.  You should have no problem pulling this into Excel by specifying the appropriate text delimiter.  This can be accessed under the "Query Results" section of the CMC by creating a new Security Query.
    The output represents the Object Name and ID (Custom Access Level 1 = 1522), the type of object, scope, etc.  I exported this for the Administrators group specifically, and it does have a limitation of only being able to run for a single group at a time, but will give you substantial information.
    Let me know if you'd like additional detail.
    Thanks,
    Jim

  • Java.exe has encountered a problem and needs to close.

    I installed Oracle8i on my P4 then when I reboot I get the error "java.exe has encountered a problem and needs to close." even if I click on "don't report" if keeps popping up, anything to do to resolve this?
    Thanks.

    Hello...
    i had the same problem. then when i searched oracle documentation, it suggested as follows:
    1. go to your %ORACLE_HOME%\Apache\Apache\conf\httpd.conf
    2. comment out 2 lines that has
    include ....\jserv.conf
    include ....\oracle_apache.conf
    so your new line will be:
    #include ....\jserv.conf
    #include ....\oracle_apache.conf
    Those lines are at the end of the file.
    3. save the file.
    4. reboot your machine.
    that solution works for me.. hope it works for you too.
    GOOD LUCK!
    --Melani                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to attach a Contact at Customer Account Level.

    Hi All,
    I want to know how to attach a contact at customer Account Level. Please let us know the API for the same.
    Or share some sample code if any.
    Thanks in advance.

    Hi,
    Are you using R11 or R12?
    Well i have an API that i used in R11 for the creation of contacts:
    hz_party_contact_v2pub.create_org_contact
    hz_contact_point_v2pub.create_contact_point
    Hope this helps you..
    Vik

  • Customer Level Contact and Customer Site Level Contact

    Hi,
    How to create a customer level contact and Customer site level contact details for the existing Customer using standard API's. please Guide me any one with Queries.
    It will be great help for me.
    Thanks,
    Prakash

    Pl post your EBS version. For 11i, all public APIs are listed at http://irep.oracle.com. For R12, APIs can be explored using the Integration Repository responsibility in your instance
    HTH
    Srini

  • Check if Custom Permission level exists or not

    I have cretaed a custom permission level.
    On feature activation, i need to check if that custom permission level exists or not. How can i do that?
    Thanks,
    Avni Bhatt

    Check if below helps
    SPWeb web = SPContext.Current.Web;
    // Validate the page request to avoid
    // any malicious posts
    if (Request.HttpMethod == “POST”)
       SPUtility.ValidateFormDigest();
    // Get a reference the roles that are
    // bound to the current user and the role
    // definition to which we need to verify
    // the user against
    SPRoleDefinitionBindingCollection usersRoles = web.AllRolesForCurrentUser;
    SPRoleDefinitionCollection roleDefinitions = web.RoleDefinitions;
    SPRoleDefinition roleDefinition = roleDefinitions["Full Control"];
    // Check if the user is in the role. If not
    // redirect the user to the access denied page
    if (usersRoles.Contains(roleDefinition))
       //Check if post back to run
       //code that initiates the page
       if (IsPostBack != true)
        //Do your stuff here
    else
       Response.Redirect(“/_layouts/accessdenied.aspx”);
    http://blog.rafelo.com/2008/10/13/programmatically-checking-user-roles-or-permission-levels-in-sharepoint-2007/
    http://yoursandmyideas.wordpress.com/2011/10/08/setting-custom-permission-levels-in-sharepoint-programmatically/
    Or check if it exist and then delete and recreate it
    string[] yourCustomRoles = {"Level1", "Level2"};
    using (var web = spSite.OpenWeb())
    var roles = web.RoleDefinitions;
    foreach(var levelName in yourCustomRoles)
    try
    roles[levelName];
    roles.Delete(levelName);
    catch(Exception)
    // web has no this role
    //Add code here
    http://go4answers.webhost4life.com/Example/delete-specific-permissions-108626.aspx

  • Custom Access Level/User groups in BOBJ XI

    Experts,
    We are currently implementing BOBJ XI 3.1. Up on go-live, it will be handled by the Operations team from BOBJ CMC. We do not want to give administrator group for the operations users in CMC. Instead, we want to create custom groups with custom access levels.
    Ex. one for basis who will set up authentication, licenses etc
          one for the functional folks to maintain universes, export universes and set up security.
    Is there a way to set up user groups like this. We were able to successfully restrrict access just to folders, universes by creating a custom access level. But we were not able to do it on other items listed in CMC. Has anyone done this level of access before for the operations or even with in the development team instead of using administrator group>
    Appreciate your response
    Thanks
    Kee

    Hi,
    We can assign different rights to a group by creating custom access levels.
    Create a new group ,and also create custom access level and assign it to the new group.
    you can provide access to different objects to the group by adding rights to the access level.
    Under the access level > click  Included Rights > Add and Remove Rights > Under the Rights Collection > click on System.
    You  could find all the CMC object access rights can be assigned.
    Regards,
    Rameez

Maybe you are looking for