Setting Appender's fields in Apache's Log4J

Hi,
In the following code snippet (which is written to create a FileAppender & make log4J log to that file):
import org.apache.log4j.*;
class sample
HTMLLayout layout = new HTMLLayout();
layout.TITLE_OPTION = "DataSE Log";
String logFileName = "Log.txt";
Appender appender = new FileAppender(layout, logFileName, true);
appender.immediateFlush = false;
appender.bufferedIO = true;
appender.bufferSize = 64;
Logger logger = Logger.getLogger();
logger.addAppender(appender);
the above snippet is not inside any method. Its directly within the class. In the above snippet, I am encountering 2 types of errors:
1. Am using the fields of the classes FileAppender & layout. The usage seems to be wrong, because am getting the error "'synatx error on token(s); misplaced construct(s)" & similar errors.
2. how to specify the bufferSize? Just as '64' or '64K'?
Thanks.

1. Am using the fields of the classes FileAppender &
layout. The usage seems to be wrong, because am
getting the error "'synatx error on token(s);
misplaced construct(s)" & similar errors. logger.addAppender(appender);
You can't have statements like those there. At least use a static initializer (static { ... } ) to do all the stuff you're doing.
2. how to specify the bufferSize? Just as '64' or
'64K'?Wouldn't that depend on the type of the field and its usage? RTFAPI.

Similar Messages

  • VA02 user exit - cannot update append structure field in XVBAP/VBAP

    Hi Guys,
    I am currently using one of the many user exits in updating XVBAP to update the VBAP sap table in VA02.
    However I am encountering a problem when updating a customized append structure field. When I change the value of the append structure field only it doesnt update in VBAP upon save event. Only when I also change a sap standard field (ARKTX) the append structure gets updated.
    Is there a way to resolve this wherein even if I just XVBAP-<append structure field> only ... the corresponding field in VBAP gets updated?
    THanks guys and hope to hear from you soon.

    Hi,
    Which userexit subroutine are you using to move the append structure field values to the XVBAP table?  Are you having the user enter values on a screen during VA02 for the append structure fields, or are you setting those values within the code when the user saves?  For the purposes of this response, I will assume you are not having the user enter the values, and that (from what you have described) you are using subroutine userexit_move_field_to_vbap. 
    While userexit_move_field_to_vbap sounds logical at first, you should be aware that this subroutine (which is called at the end of module vbap_fuellen) may only be called when one of the chain fields (in the flow logic of the VA02 screen) is changed.  If you search for all the calls of module vbap_fuellen in screens of SAPMV45A, you will see that most of them have a list of chain fields with "on chain-request" logic.  Since your append structure fields will not be listed in the flow logic of the standard VA02 screen, changing one of the append structure fields alone would not trigger the PAI module vbap_fuellen.  Of course, changing a standard VBAP field (ARKTX was your example) could trigger the vbap_fuellen module (as long as it was one of the chain fields) which would consequently trigger the userexit_move_field_to_vbap subroutine.
    You may want to consider trying USEREXIT_SAVE_DOCUMENT_PREPARE.  Please explain further if I have misunderstood your question. 
    Anyone else out there have any ideas?  Does my analysis make any sense?
    Best Regards,
    Jamie

  • How to use Radio Buttons in SAP BI 7 for a set of three fields?

    Dear SAP Gurus,
    We are using SAP BI 7. We need to use Radio button to select one field name (out of a set of three fields) which
    appeared on selection screen.
    The scenario is; we have three fields
    1) Field Name A
    2) Field Name B
    3) Field Name C
    Now, we need to select one field(using Radio button) from the above and later the report related to the above
    selected field should be displayed.
    The three reports will be as follows:
    1) Report A
    2) Report B
    3) Report C
    if Field Name A  is selected then Report A  will be displayed,
    if Field Name B  is selected then Report B  will be displayed and
    if Field Name C  is selected then Report C  will be displayed.
    To display the report we have two cases;
    1) There will be a common selection screen and all the three reports will come in single workbook but in seperate worksheet.
    2) There will be a common selection screen and all the three reports will come in same worksheet, one after the other.
    Is it possible to create the report in this manner, if yes, please suggest the steps.
    Regards,
    DV.

    I think you would just use commands to do the following:
    1. Hide report Analysis Item 2 and Analysis Item 3 if the 1st button was pushed.
    2. Hide report Analysis Item 1 and Analysis Item 3 if the 2nd button was pushed.
    3. Hide report Analysis Item 1 and Analysis Item 2 if the 3rd button was pushed.
    Hope that helps...

  • HOW TO SET A RAW FIELD

    Hi,
    I'd like to know how I can set a RAW field with the correspondent '10' value (for '10' i mean the byte value of '00000101').
    Is there a manner to do this at low level, without cast ?
    Thanks and best regards,
    Neil

    The string 00000101 generally represents the binary value of 5 so I am unsure of exactly what you want but maybe the following will help:
    UT1 > set echo on
    UT1 > col dumped format a30
    UT1 > drop table example;
    Table dropped.
    UT1 > create table example (fld1 varchar2(10), fld2 raw(02));
    Table created.
    UT1 > insert into example values ('Row 1',hextoraw('05'));
    1 row created.
    UT1 > insert into example values ('Row 2',hextoraw('0A'));
    1 row created.
    UT1 > select fld1, fld2, dump(fld2,16) as dumped from example;
    FLD1 FLD2 DUMPED
    Row 1 05 Typ=23 Len=1: 5
    Row 2 0A Typ=23 Len=1: a
    Being that on a big endian machine the 8 bits of a byte are 0 - 7 numbered left to right and on a little endian machine the bits are 0 - 7 right to left this may be where the confusion in your post is coming from. On my system the Oracle functions appear to follow big endian set and display patterns but I suspect that the physical byte settings match. You would need to test this by dumping the raw data on the target platform. The only difference this makes is the character value you would choose to get the bit pattern you want.
    The dbms_raw package provides varchar2 to raw and back conversion functions.
    HTH -- Mark D Powell --

  • How to set a payload field value only once for multiple instances selected?

    The user needs to set a payload field value and then he can approve the task so the task can continue through the process, that's fine when the user selects one instance and sets the value in the task details section and then clicks the approve button, but how do we achieve the same behavior in a multiple way?, I mean the user can select multiple tasks in the workspace (in this case the details task page is not available and instead the following label appear "Multiple tasks selected") then if the user clicks the Actions drop down -> APPROVE he only gets the message "your request was processed successfully", so how can the user modify the payload field value only once for all the selected tasks so when he clicks APPROVE the value is populated in all the instances selected.
    Thanks,
    Carlos.

    In the action which displays the edit page just set the form idx value before displaying the jsp.

  • Can't set a hidden field value from onClick event with a runtime expression

    Hi,
    I need to set a hidden field in an onClick event of button but it's not working.
    <html:submit styleClass="btnLink" onclick="document.empForm.hidden.value='<%= empID%>'">
    <%= empID%>
    </html:submit>
    Althought the second expression is evaluated and written successfully "the button value"
    I heard that this is because you can't mix the value of an attribute of a custom tag with both string literal and run time expressions.
    Is there any work around to solve that?
    I can't use EL as I'm using old JSP version

    I guess, it should work; instead of html:submit, try with button.

  • How to set the 'Lot' field in Batch Pending (Product) Lots as 'Optional'

    We are now Upgrading FROM 11.5.10.2 To r12.1.3.
    The 'Lot' field under Batch material Details -> Pending Product Lots is mandatory, Which is very bad for us.
    Our Current (11i) business process for creating Product lots, is to 1st allocate the 'Lot', and later on allocate and complete the 'Sublots' within this lot.
    The equivalent process in r12 should be: 1st allocate the 'Parent Lot', and later on allocate and complete the 'lots' within this Parent lot.
    Question: Is there any way to set the 'Lot' field to be optional?
    Thanks,
    Eran.

    Hi
    No this is not possible, since Parent lot is a subset of Lot in R12. Once you choose your item as LOT, then it is not possible to make as Optional.
    Try to raise an SR for this, Oracle may provide some workaround for the same.
    Rgds
    Raj
    NTTData India

  • Setting primary key fields from sequence. Please advise

    What is the most logical place to automatically set primary key fields from
    sequence?
    jdoPrestore seems to be a little late - my instance will not have id till
    it's committed. I can not do it in constructor because it gets called every
    time Kodo needs to construct an instance. What other options do I have for
    automatic pk assignment except do it in my code (hate it)?
    I wish I could use store managed OIDs but I need access to OID underlying
    data
    Please also see my previous message "Application Identity Extention"

    I came up with following pattern:
    public class OrgUnit implements InstanceCallbacks {
    private long orgUnitId = -1;
    private transient long tempOrgUnitId = -1;
    public long getOrgUnitId() {
    if (orgUnitId < 0) {
    if (tempOrgUnitId < 0) {
    tempOrgUnitId = JDOFactory.getNextSequenceId(getClass());
    return tempOrgUnitId;
    } else {
    return orgUnitId;
    public void jdoPreStore() {
    if (!JDOHelper.isDeleted(this)) {
    if (orgUnitId < 0) {
    setOrgUnitId(getOrgUnitId());
    I use -1 as an indicator that ID has not been assigned yet. If you use Long
    instead of long it will be cleaner since we can test for null
    "Alex Roytman" <[email protected]> wrote in message
    news:9q27co$r35$[email protected]..
    What is the most logical place to automatically set primary key fieldsfrom
    sequence?
    jdoPrestore seems to be a little late - my instance will not have id till
    it's committed. I can not do it in constructor because it gets calledevery
    time Kodo needs to construct an instance. What other options do I have for
    automatic pk assignment except do it in my code (hate it)?
    I wish I could use store managed OIDs but I need access to OID underlying
    data
    Please also see my previous message "Application Identity Extention"

  • Set the default field value to transaction code field, when calling from WD

    Hi all,
    Can we pass the value in a input field of a standard transaction calling from WD application. Suppose we are calling a transaction VA03 in an external window, then how will be pass the value in the VBAK_VBELN screen field.
    Is there any way to pass the value to this transaction field. I have also tried out to set the parameter ID 'AUN' for VA03 transaction VBELN field. But it did not work for me.
    Is there any way to set the default field value to transaction code field, when calling from WD?
    Please suggest, if anyone have any idea.
    Thanks
    Sanket

    Hi,
    I am using the below code to open a standard transaction. It will help you to explain my point more easily.
    DATA: url TYPE string,
              host TYPE string,
              port TYPE string.
    *Call below method to get host and port
      cl_http_server=>if_http_server~get_location(
         IMPORTING host = host
                port = port ).
    *create URL
      CONCATENATE 'http'
      '://' host ':' port
      '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=' 'VA03'
       INTO url.
    *get the window manager as we are opening t code in external window.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component TYPE REF TO if_wd_component.
      DATA lo_window TYPE REF TO if_wd_window.
      lo_api_component = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
    call the url which we created above
      lo_window_manager->create_external_window(
      EXPORTING
      url = url
      RECEIVING
      window = lo_window ).
      lo_window->open( ).
    Note*
    One more query I want to add to this thread, that is there any possibility to call a custom transaction as well?

  • How do you set the From field in Mail?

    Is there any way to set the From field in messages. I have two email addresses:
    an .edu address at an university
    a .net at my ISP
    I’d like the From field to be my .edu addreess. Mail sent to my .edu address is forwarded to an address of my choosing, which happens to be my .net address. I would, however, like to keep my .net relatively hidden so I can change ISPs. We did that year switching from cable to DSL.
    I tried changing Mail Preferences->Accunts->Email Address
    to my .edu address. That, however, did not work. My DSL provider ignored the Email Address field and inserted my .net address in the from field. (I believe this method worked when I had a cable ISP.)

    Since my last post, I found tried putting
    Preferences->Accounts->Email address to be my edu address
    would add my .edu address as one of my from choices
    Next, I sent myself a mail message, with following result:
    The .edu address is now rejected by the outgoing server with the message:
    Cannot send message using the server
    The sender address (my .edu address) was rejected by the server
    I had this working at some time, but not now. Help, please.

  • How to set the expires field to stop caching of pages

    I want to set the expires fields of the HTML data on pages delivered by weblogic, so caching servers(ie ISA) and clients dont cache the my pages. How do I do this?
    Thanks for any help

    I guess that's the NI Domain (NI Security Login) user name. Check out Tools->Security->Login in LV main menu.

  • How to set Mandatory Choice field while Creating Custom Task using Sharepoint Designer 2007

    Hi,
    I am new to Sharepoint development.I dont know whether i am posting  the question in Correct place.Kindly redirect me to the correct place if i am posting it in wrong place.
    I  created a custom task in Sharepoint Designer 2007 using
    Collect Data from User
    Action.
    I created a field in the task form which is of choice type and
    unchecked allow blank values
    because i  wanted that field to be a mandatory field.When i handled that task ,i was able to complete that task
    without selecting that mandatory field.But, I was expecting not to allow me to complete the task without selecting that field. Kindly  tell me how to set the choice field as mandatory.

    Hi,
    You are using SharePoint Designer 2007, so I moved the thread to the appropriate forum for MOSS 2007.
    This is by design that
    Workflow-generated form (for action Collect data from User) does not perform validation properly on drop-down choices, the workaround is to use JavaScript to perform the field validation.
    This thread has the JavaScript code can help you:
    http://social.msdn.microsoft.com/forums/en-US/sharepointworkflow/thread/0ad7fc3c-97a1-464e-ae89-c3133462dda8/
    Xue-Mei Chang

  • [AS][INDCC] How to set Color Conversion field to No Color Conversion when creating PDF Export preset

    How can i set Color Conversion field in Export to PDF dialog to No Color Conversion when creating PDF Export preset? i have done a bit of searching and have found where it has been recommended to set effective pdf destination profile to use no profile but it doesn't seem to be producting the expected results.

    Yes, it seems that i had to make the change after creation, not while creating the preset. thank you.
    tell application "Adobe InDesign CC"
         set newPreset to make new PDF export preset with properties ¬
              {name:"preset name", standards compliance:none, acrobat compatibility:acrobat 7}
         tell newPreset to set PDF color space to unchanged color space
    end tell

  • How Can I Set the Search Field in iTunes?

    In applescript...
    In another app - I have copied a song title to the clipboard...
    Q: Now - How Can I Set the Search Field in iTunes to the clipboard contents?
    Q: Also how can I also open the main library itunes window?

    Hi Rev Dave,
    Q: Now - How Can I Set the Search Field in iTunes to
    the clipboard contents?
    Unfortunately the only way I can think to achieve this involves the use of "UI Scripting". The other previous posters have given you the preferred method you should consider using. If you want to script iTunes so that you visually see the search take place in iTunes you'll need to use the method shown in the script I've posted below.
    Q: Also how can I also open the main library itunes
    window?
    Cyclosaurus has given you the answer to this part of your question already.
    Here is a script that (though ugly IMHO) should achieve what you are asking for:set theSearch to (the clipboard) as string
    tell application "iTunes"
    activate
    set allPlaylists to playlists
    repeat with aList in allPlaylists
    if name of aList is not "Library" then
    set view of front browser window to aList
    exit repeat
    end if
    end repeat
    set LibList to playlist "Library"
    set view of front browser window to LibList
    end tell
    tell application "System Events"
    tell process "iTunes"
    if "iTunes" is not in name of windows or ¬
    focused of window "iTunes" is false then ¬
    keystroke "1" using command down
    keystroke tab
    keystroke theSearch
    end tell
    end tellIn order for the above script to work you need to have "Enable access for assistive devices" enabled in the "Universal Access" section of the "System Preferences" application.
    If you have any further questions about the above script feel free to ask.
    Hope this helps...
    iBook G4 1GHz   Mac OS X (10.4.3)   640 MB RAM

  • MySQL to Oracle Migration Issue - Unknown character set index for field.

    Hi,
    Looking for help..!!!
    Migrating mySQL - version 4 database to Oracle 10g using oracle migration work bench. It went well until the last step. But, during the data migration, OMWB has given the following error:
    +++++++++++
    Unable to migrate data from source table gets.sales_order_01 to destination table gets_ora.sales_order_oracle10: gets_ora.sales_order_oracle10; Unknown character set index for filed "12596" received from ser.
    +++++++++++
    Log file shows:
    java.sql.SQLException: Unknown character set index for field '12596' received from server.
         at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:1692)
         at com.mysql.jdbc.Field.<init>(Field.java:161)
         at com.mysql.jdbc.MysqlIO.unpackField(MysqlIO.java:510)
         at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:285)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1326)
         at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:1225)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2278)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:2225)
         at com.mysql.jdbc.Statement.executeQuery(Statement.java:1163)
         at oracle.mtg.migrationServer.LoadTableData._migrateTableData(LoadTableData.java:563)
         at oracle.mtg.migrationServer.LoadTableData.run(LoadTableData.java:326)
         at oracle.mtg.migration.WorkerThread.run(Worker.java:268)
    I appreciate your help in this regards.
    Regards,
    K

    Hi K,
    Whats the default character set of you MySQL and Oracle Databases.
    What version of JDBC driver are you using?
    Is there any unicode characters used in your data?
    Have you tried offline data move?
    Thanks
    Dermot.
    Message was edited by:
    dooneill

Maybe you are looking for

  • How do i deactivate a photoshop key in windows.old?

    I've been pulling my hair out over this one and can't find any answers after many google searches. I'm running windows vista, and got some weird virus the other day that wouldn't let me open any programs or see anything on my desktop and my only real

  • Can't see "wmv" files in my e mail   (won"t play"

    i have tried to download a program to let me see wmv files that i get in my email, never worked, and still can't see any wmv files

  • Custom home screen for apple tv

    Hello users,   I have set up several apple tv's as wireless interfaces for ipads.  I would like the home page to be a custom page stating the name of our business rather then adds for movies.  I am an apple devotee and do not wish to jail break to ge

  • Logging & Capturing always comes in at 4:3 & Sequence Settings

    Hi All, There is only so much a class on Final Cut could teach me. We have an AJA and I was lead to believe it was the issue, but now I'm not sure. Whenever I capture something I always get the media in 4:3. Its a pain in the butt when you always hav

  • Sub-tempalte based on data source

    I've followed this blog; http://www.adivaconsulting.com/adiva-blog/item/36-working-with-rtf-sub-templates.html The AC_Heard or AC_Footer is not based on any data source, sub-template can be based on a data source? I want to pull data from database an