LOG4J Filtering of only One Level

i am using the LOG4J utitlity given by Apache. i want only the logger.debug() statements output to be sent to a text log file.
if i execute the below example, the output entered into the log file is DEBUG - DEBUG
INFO - INFO
WARN - WARN
ERROR - ERROR
FATAL - FATAL
but according to my requirement, the output should be
DEBUG - DEBUG.
please can any one help me out to provide solution.
import org.apache.log4j.*;
import java.io.*;
public class simpandfile {
     static Logger logger = Logger.getLogger(simpandfile.class);
     SimpleLayout layout = new SimpleLayout();
     FileAppender appender = null;
     public simpandfile() {
          super();
          try {
               appender = new FileAppender(layout, "C:\\output.txt", false);
          } catch (IOException e) {
     public void test1() {
          try {
               logger.addAppender(appender);
               logger.setLevel(Level.DEBUG);
               logger.log(Level.toPriority(1), "sss");
               logger.debug("DEBUG");
               logger.info("INFO");
               logger.warn("WARN");
               logger.error("ERROR");
               logger.fatal("FATAL");
          } catch (Exception e) {
     public static void main(String args[]) {
          simpandfile saf = new simpandfile();
          saf.test1();
Regards,
Sudheer Raju.

AFAIK this is not possible with log4j except by writing a custom Logger subclass which is not very difficult.
But, your question doesn't have anything to do with JSF and would had been better asked in log4j's forum/mailinglist.
-Henri

Similar Messages

  • Loading xml file in to database (inserting only one level)

    Hi All,
      I am trying to load an xml file into db using ssis..when i am trying to load the data in xml its loading only first row..
    sample xml:
    <?xml version="1.0"?>
      <Products>
        <Product ID="Level1_75000000" UserTypeID="Level1" ParentID="Products_6537">
          <Name>Household/Office Furniture/Furnishings</Name>
          <Product ID="Level2_75020000" UserTypeID="Level2">
            <Name>Fabric/Textile Furnishings</Name>
            <Product ID="Level3_75020100" UserTypeID="Level3">
              <Name>Household/Office Fabric/Textile Furnishings</Name>
              <Product ID="Level4_10002215" UserTypeID="Level4">
                <Name>Fabric/Textile Window Blinds</Name>
              </Product>
              <Product ID="Level4_10002214" UserTypeID="Level4">
                <Name>Curtains</Name>
              </Product>
              <Product ID="Level4_10002221" UserTypeID="Level4">
                <Name>Household/Office Fabric/Textile Furnishings Other</Name>
              </Product>
              <Product ID="Level4_10002220" UserTypeID="Level4">
                <Name>Household/Office Fabric/Textile Furnishing Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002219" UserTypeID="Level4">
                <Name>Fabric/Textile Towels</Name>
              </Product>
              <Product ID="Level4_10002218" UserTypeID="Level4">
                <Name>Furnishing Floor Rugs/Mats - Detachable</Name>
              </Product>
              <Product ID="Level4_10002217" UserTypeID="Level4">
                <Name>Cushions</Name>
              </Product>
              <Product ID="Level4_10002216" UserTypeID="Level4">
                <Name>Furnishing Covers/Cloths - Detachable</Name>
              </Product>
            </Product>      
            <Name>Ornamental Furnishings</Name>
            <Product ID="Level3_75030100" UserTypeID="Level3">
              <Name>Ornaments</Name>
              <Product ID="Level4_10002231" UserTypeID="Level4">
                <Name>Ornaments</Name>
              </Product>
              <Product ID="Level4_10005692" UserTypeID="Level4">
                <Name>Ornament Accessories</Name>
              </Product>
              <Product ID="Level4_10002238" UserTypeID="Level4">
                <Name>Ornaments Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002249" UserTypeID="Level4">
                <Name>Candle Holders/Accessories</Name>
              </Product>
              <Product ID="Level4_10002236" UserTypeID="Level4">
                <Name>Seasonal Decorations (Non Powered)</Name>
              </Product>
              <Product ID="Level4_10002237" UserTypeID="Level4">
                <Name>Seasonal Decorations (Powered)</Name>
              </Product>
              <Product ID="Level4_10000555" UserTypeID="Level4">
                <Name>Candles</Name>
              </Product>
              <Product ID="Level4_10002234" UserTypeID="Level4">
                <Name>Decorative Magnets/Stickers/Window Clings</Name>
              </Product>
              <Product ID="Level4_10002235" UserTypeID="Level4">
                <Name>Sun/Dream Catchers/Windchimes</Name>
              </Product>
              <Product ID="Level4_10002232" UserTypeID="Level4">
                <Name>Artificial Flowers/Plants/Trees</Name>
              </Product>
              <Product ID="Level4_10002233" UserTypeID="Level4">
                <Name>Vases</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030600" UserTypeID="Level3">
              <Name>Ornamental Furnishings Variety Packs</Name>
              <Product ID="Level4_10003816" UserTypeID="Level4">
                <Name>Ornamental Furnishings Variety Packs</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030200" UserTypeID="Level3">
              <Name>Pictures/Mirrors/Frames</Name>
              <Product ID="Level4_10002241" UserTypeID="Level4">
                <Name>Posters/Prints</Name>
              </Product>
              <Product ID="Level4_10002240" UserTypeID="Level4">
                <Name>Paintings</Name>
              </Product>
              <Product ID="Level4_10002243" UserTypeID="Level4">
                <Name>Photographs</Name>
              </Product>
              <Product ID="Level4_10002245" UserTypeID="Level4">
                <Name>Mirrors</Name>
              </Product>
              <Product ID="Level4_10002247" UserTypeID="Level4">
                <Name>Pictures/Mirrors/Frames Variety Packs</Name>
              </Product>
              <Product ID="Level4_10002246" UserTypeID="Level4">
                <Name>Picture Frames</Name>
              </Product>
              <Product ID="Level4_10002248" UserTypeID="Level4">
                <Name>Picture/Mirrors/Frames Other</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030700" UserTypeID="Level3">
              <Name>Decorative Banners/Flags</Name>
              <Product ID="Level4_10005816" UserTypeID="Level4">
                <Name>Decorative Banners/Flags</Name>
              </Product>
            </Product>
            <Product ID="Level3_75030400" UserTypeID="Level3">
              <Name>Clocks</Name>
              <Product ID="Level4_10004101" UserTypeID="Level4">
                <Name>Clocks - Replacement Parts</Name>
              </Product>
              <Product ID="Level4_10002252" UserTypeID="Level4">
                <Name>Clocks</Name>
              </Product>
            </Product>
          </Product>
             </Product>
      </Products>
     Please suggest..

    Hi RAGS1109,
    If our XML data starts to get more complicated (multiple levels of elements / attributes), we start getting more outputs, we will have to join those outputs with a merge join transform.
    Please refer to the following document how to dealing with multiple outputs for XML data source:
    Using XML Source:
    http://blogs.msdn.com/b/mattm/archive/2007/12/11/using-xml-source.aspx 
    Process Multi-Level XML in SSIS:
    http://www.youtube.com/watch?v=rFgLV58EcXA
    If you have any feedback on our support, please click
    here.
    Elvis Long
    TechNet Community Support

  • TLN with one level

    Hi,
    If the TLN is configured to show only one level and DTN to start from the second level, the first time a user enter on the portal, the first node of TLN is not select.
    What could be the problem?
    Version:
    6.0.2.2.4
    Thanks and Regards,
    John

    Hi John,
    Do you have any sort priorities set up on pages, or iviews?
    Paul

  • Hide Top level navigation if user assigned only one role

    Hi,
    I would like to hide the top level navigation if user assigned with only one role.
    I can create role based rule to show desktop using Master rule collection, but is it possible by doing to with role count.
    If user has multiple roles show desktop1 else show desktop2

    not sure if this possible ,you may check feasibility of creating  a application which checks user role count and if role count is = 1 load the Portal url (URL alais) which had TLN iview invisible in the same window else do nothing and load the portal with the desktop which has tln.
    Put the application in framewrk page which has TLN visible.
    create a URL alias and create a desktop -framework page which dont have TLN ,assign this desktop to this URL alias in rule collection set its priority before user conditions check in rule collection so that it has high priority before user or group check in rule collection.
    you can create a poc in sandbox and check if it wiorks?

  • Only one top level element is allowed in an XML document. Line 2, Position 2

    I get this error when I try to run an xsql query with a where clause:
    Only one top level element is allowed in an XML document. Line 2, Position 2
    <font size='-1' face='monospace'>XSQL-005: XSQL page is not well-formed.</font><BR>
    -^
    Here is the xsql query I tried to use.
    <?xml version="1.0"?>
    <xsql:query connection="xmlbook" xmlns:xsql="urn:oracle-xsql">
    select * from companytable where companynumber < 1000;
    </xsql:query>
    null

    You need to escape certain characters in order to make XML documents well formed. The problem in this case is the less than sign between companynumber and 1000. You should replace it with <
    I recommend reading a good XML book - "Building Oracle XML Applications" by Steve Muench, for instance.
    Brian

  • Only one Custom field is missed in  Service Level Determination

    Hi
    I have extended Service Request BO with 4 field, one field is ID type and rest of field are Text type.
    in Service Entitlement-> Service Level Determine-> adapt column, "Decision table configuration" under the available column I can see all the extended field( SDK & KUT), but only one extended field(ID type) is missed.
    Could anyone explain how to bring that field there.
    Thanks
    Sunil Maurya

    Hi Bharadwaj,
    Thank you for your inputs. I executed the program but it didn't display the field.
    But I was able to rectify it by re-creating the steps mentioned in the blog (see original post). I had missed giving correct positions to the custom field.
    Regards
    Kishan

  • Nodes with Only One Lower-Level Node = Hide

    Hi everyone
    Have anyone present this situation:
    Iu2019ve a quey to report inventory aging. It has two hierarchies to show data. In Rows I have Major Markets and in Columns a date hierarchy to show aging Ex: from 0 to 8 months, 9+ and 13+. Of course here I have also value and volume.
    Query reports all values for all major markets fine. When I filter one major market, letu2019s say France also brings detailed figures but when I add any drill down in rows all values goes to cero (0).
    Te estrange is that if you swap drill down order with major markets or drill down by columns with the same characteristic figures come out again as usual.
    I know this sounds like a SAP note but I have not been able to find it either.
    Thanks a lot for your help, and of course points will be assignedu2026..
    Ps. Important, this happen when  option u201CNodes with Only One Lower-Level Node = Hideu201D (this is selected on purpose because there are some repeated nodes in major market hierarchy Ex. France u2013 France and if there is just one value under first node then means that only display of last one is necessary to avoid repeated values).

    Solution we found is to remove flag "Do not display leaves for inner-nodes in the query", directly on the hierarchy.
    Thanks

  • Security Filter fails when level has only one member

    Hi.
    This is Essbase version 9.3. I have a forecast app\db to allow users enter\modify the forecast of the different products. The Product Dimension has the following hierarchy.
    All Products
    Planner 1
    Supplier A
    Product_A1
    Product_A2Supplier B
    Product_B1
    Product is the lowest level, level 0, or Gen 4.
    I need to allow the "Planner 1" to write only to his products, where the member is "My Scenario" from Scenario Dimension, and where the UDA's for the month is Forecast. The same planner can't write to the "All Products", "Planner" and "Supplier" levels.
    I have created the following filter:
    None: "All Products"
    Read: @IDESCENDANTS("Planner 1")
    Write: @REMOVE(@LIST(@DESCENDANTS("Planner 1")),@LIST(@LEVMBRS ("Planner 1", 1))), "My Scenario",@UDA("Time","FORECAST")
    Basically, this is the portion most relevant of the filter: @REMOVE(@LIST(@DESCENDANTS("Planner 1")),@LIST(@LEVMBRS ("Planner 1", 1)))
    where
    @LIST(@DESCENDANTS("Planner 1") = List of descendants members from Planner 1, excluding Planner 1. = "FIRST LIST"
    @LIST(@LEVMBRS ("Planner 1", 1)) = List of level 1 members from Product Dimension. = "SECOND LIST"
    @REMOVE will remove values or members in the "SECOND LIST" from the "FIRST LIST".
    This filter works perfectly but it has a little\big exception...
    Based on the example, the filter works fine for Supllier A. Meaning that the user can modifiy the forecast for the products under Supplier A (Product_A1 and Product_A2), and the user can't modify the upper levels, "Supplier A", "Planner 1", "All Products". This is GOOD!
    Now. For Supplier B, Essbase will allow write back to the Product_B1, OK. But will also allow write back to Supplier B, the upper level.
    So. When the supplier has only one product, Essbase presents this exception that allows write to the upper level. This happens everywhere a supplier has only one product. When there are more than one product per supplier, the filter works as expected.
    Is there a missing piece in my filter? Is there a different, better approach to accomplish this?
    Thanks.

    It's probably an implied share problem. That is, because Supplier B has only one child it is treated as a shared member. You can use the "never share" storage property setting to avoid that problem.

  • Msg 116, Level 16, State 1, Line 6 Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

    Hello,
    Can anyone help me?
    select year(po.rdata) as 'Ano', 
    sum(etotal) as 'Valorp' ,
    (select year(fo.data),Sum(etotal) 
    FROM fo (nolock) 
    where  not exists ( select 1 from pl (nolock) where pl.adoc = fo.adoc and pl.cm = fo.doccode ) 
    group by year(fo.data))as 'Valorap'   
    from po 
    group by year(po.rdata)
    order by year(po.rdata)
    Error 
    Msg 116, Level 16, State 1, Line 6
    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
    Consultora

    Hi Prashanth,
    select year(po.rdata) as 'Ano',
    sum(etotal) as 'Valorp' ,
    (select Sum(etotal)
    FROM fo (nolock)
    where not exists ( select 1 from pl (nolock) where pl.adoc = fo.adoc and pl.cm = fo.doccode )
    group by year(fo.data))as 'Valorap'
    from po(nolock)
    group by year(po.rdata)
    order by year(po.rdata)
    Gives me the error: 
    Msg 512, Level 16, State 1, Line 1
    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
    Thanks
    Consultora

  • CS_WHERE_USED_MAT only returns one level

    Hi all,
    I need to get the results that CS15 (where-used) gives me when multi-level is checked.
    I need to write a program and was hoping to use FM CS_WHERE_USED_MAT.  However, this FM only returns the materials that are one level down.  I'm on 4.5b.
    Does anyone know what FM I can use that will give me the materials at all levels (like CS15 does).  I can use CS_WHERE_USED_MAT and feed back in each material until I reach the end of the levels.  But I was wondering if anyone has found a better way.
    Thanks,
    Mike

    you can refer link:[http://wiki.sdn.sap.com/wiki/display/Snippets/InverseBOMExplosion-ABAP]
    or use fm CS_BOM_EXPL_MAT_V2 pass X to field MEHRS

  • RemovingContext only for One level(Message Mapping)

    Hi,
    Is it possible to remove context only for one level?
    For Eg:If I apply [RemoveContext] function to <Item>
    I will get {A1,A2,B1,B2,C1,C2,C3,C4}
    <SourceRoot>
    <A>
    <Item r="a">A1</Item>
    <Item r="b">A2</Item>
    </A>
    <A>
    <Item r="a">B1</Item>
    <Item r="b">B2</Item>
    </A>
    <A>
    <Item r="a">c1</Item>
    <Item r="b">c2</Item>
    <Item r="c">c3</Item>
    <Item r="d">c4</Item>
    </A>
    </SourceRoot>
    But I need only those coming under a particluar <A> .
    Like {B1,B2}.
    Any way to do this?
    Can anyone help.
    Thanks in Advance
    Message was edited by: Chemmanz

    Hi,
    I was just trying to give an example. In my real case
    SOURCE - INVOIC01 IDoc
    TARGET - cXML Structure for Invoice.
    When it goes to Line item level the complexity comes.
    A similar situation as i explained needs to be solved.
    [REMOVECONTEXT] helped me a lot.
    But I this situation I want to restrict it to a single level.
    For Ex:
    <INVOIC02>
    <IDOC>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    </IDOC>
    </INVOIC02>
    1.<EIEDP01>
    <=== mapped directly to ==> <InvoiceDetailOrder>
    Then internal things are organized differently in
    <InvoiceDetailOrder> compared to IDoc element<EIEDP01>
    Ex:
    I want to take all the <EIEDP02>s coming under one line Item <EIEDP01>
    <EIEDP02> cannot be mapped diectly to cXML element. It can be done only after checking it's own attribute QUALF.
    For this I applied [REMOVECONTEXT], but i am getting all the QALF values.
    I need to restrict it to <EIEDP01> level.
    Regards
    Chemmam

  • Need Inspection lot creation at only one storage location level - QA07

    Hi,
    I have shelf life expired material at different storage location. When ever i run QA07.System generates inspection lot for all storage location.But I want to process the inspection lot for only one storage location. Please guide me how can we map this reqmnt.
    Thanks in advance for your relevent response.
    Thanks & Regards
    Kundan Kumar

    Hi,
    Next inspection date is maintained at the batch level, not at the storage location level.
    You can suggest the following solutions if it is feasible in your business scenario.
    Scenario 1: Batch is inwarded in one storage location"A" & stored for some time, then it is transfered to other storage loactions B & C (like production storage locations).
    In this case suggest to transfer the batch to storage loactions B & C just one or two days before the actual consumption of the batch & also keep the opening period  in QA07 sufficient days (between 10-15 days), so that the sytem will create the inspection lot in one storage location "A" . Since the batch is still not transfered to B & C, the system will not create inspection lots in B&C.
    Scenario 2: Batch is inwarded in all the storage locations with the same batch number.
    In this case suggest to inward the same bacth with different batch numbers, keeping the all other characteristic values same
    With Best Regards
    Vithal

  • Level/Generation of members with only one child

    Hello!I have a little problem with generations and levels in an outline like this: Dimension Member1 Member1a Member1b Member2 Member2a Member3 Member3a Member3b"Member2" has only the child "Member2a". All other members in generation 2 have more than one member. The function @CURGEN(Dimension) shows for all these members the value 2, but for the member "Member2" it shows generation 3 and level 0. In my opinion "Member2" is generation 2 and level 1.Who is wrong? Essbase? Thanks for your support!Andreas

    This is the classic 'implied share' gotcha. When a member has only one child, Essbase by default sets up the child as a shared member to the parent. I believe this was an attempt to save space etc. but it causes problems in @ functions and partitions (and maybe elsewhere!). You need to tag the parent (level 1) member as 'never share'. This should solve it.

  • Is there only the one level of undo in color?

    I really hope there are more levels. I like to adjust several things and undo them sequentially to see the look...

    Only one Undo. However, if you are doing a lot of your work in the Secondaries, you can disable each secondary, one at a time. Same with the ColorFX room, just select Bypass for the individual node.
    On top of that, you can have up to 4 grades and you can bounce between them by just selecting the grade on the timeline.

  • SAP APO DP CBF - Change data only at one level

    Hello Guys,
    I am getting error as "Change data only at one level".
    I am getting this error while loading data in the planning book at product level (Details All on products).
    I have a default macro in the data view. However, I am getting proper results when i do a details all on some other characteristic.
    Any clue about these error message ?
    Regards,
    Jacky Jain.

    Hello Guys,
    I am getting error as "Change data only at one level".
    I am getting this error while loading data in the planning book at product level (Details All on products).
    I have a default macro in the data view. However, I am getting proper results when i do a details all on some other characteristic.
    Any clue about these error message ?
    Regards,
    Jacky Jain.

Maybe you are looking for

  • Problem in F data type

    Hi experts... I am using F data type and it gets value 5.50000000000E+10. but I want value like 5.500. I don't want to use P data type. Please Help me. thanks in advance.

  • HP photosmart D110 Mac OSX 10.8.5

    I have had to reload my printers into my Macbook pro.  I have loaded the HP photosmart D110 in the print/scan utility and can see the printer.  I also can print a test page.  When I go to print a document, I get the following message "printing-printe

  • Search result category with a custom layout set?

    Greetings, I've created a nice little search IVIEW with a custom search options set that will display the document category (taxonomy) in the search result (if the resulting document is categorized, of course.)  Works great.  However there is one lit

  • HTTPS Post with XI

    Hi mates, I've a scenario that complains a RFC call to XI and then, XI makes a HTTPS Post on a specific server. I've created a HTTP Destination (type G) on SM59, set it to use SSL at Logon & Security tab, using the DFAULT ssl client(that i've created

  • "Always on top" behavior for Navigator Window?

    Greetings, Several of our users have asked for an "Always on Top" feature for the OHJ help navigator window. We are using OHJ 4.2.3, on Windows platforms. Our application displays help topics from certain dialog buttons and menu items (using CshManag