Log4j : how to get log file name and directory

My log4j is working fine. Below is how I define the property file
log4j.rootCategory=DEBUG, A1
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.appender.A1.File=temp/log.txtI want to know, from my java program, how to retrieve my log file "temp/log.txt" because I want to display at console and notify user where to find the log file.
Thanks

Or perhaps I did not understand your requirement. Which of the following is it?
1. Given some Java class, you need to do something with its source code?
2. Given some file whose path is specified by user input or runtime configuration or compile-time constant, you need to do something with that file?
3. Neither of the above?
If 1: Can't do it. Don't need to do it. Don't waste your time trying. Unless you're writing something like a debugger. If so, then if you have to ask this question, you do not have the skills necessary for the broader task.
If 2: Google for java io tutorial. Study it, try some code, and come back with a more specific question if you're still confused.
If 3: Explain clearly what you're trying to accomplish and why you think this approach is the right one.

Similar Messages

  • How to get uploaded file name and path in BefExportToDat event script

    I would like to get hold of the uploaded file name and full path in the event script "BefExportToDat", as I need to extract values from particular fields. However I have not yet found a way to do this.
    - The input variable "strFile" returns the .Dat file path in the Outbox, to which it is about to export the data. This is no use to me.
    - The API variable RES.PstrFilename is returning nothing
    I am using RES.PstrFilename in the "BefFileImport" event script in a different FDM application and it works fine, however I need to find a way to get this to work in the "BefExportToDat" event script.
    Please let me know how this might be achieved.

    I am looking through the API calls in FDM Workbench, but cannot see the table (tPOVPartitions) you mentioned listed. Is this the correct name? And do I just use the function listed in the object browser to run the query?
    Furthermore (going back to my initial thoughts of using strFile), it appears that although the variable contains the .Dat filename and path, the actual file is non-existent when "BefExportToDat" is executed:
    Error:
    Error: Export failed.
    Detail: File not found.
    This would make sense, but it does make the variable "strFile" a little pointless since one cannot make use of the file in this particular event script. Do you please have any thoughts on this?

  • How to get the file name from directory

    Hi,
    I have a directory called test inside i have only one .txt file. i dont know that file name.
    Is it possible get the file name using PL/SQl code. ???
    Using that .txt file i have to create a dynamic table.
    If i have use *.txt also not working
    Anyone suggest me its possible to do or not????
    Cheers,
    Shan

    Hi Saubhik ,
    Wheni execute the function i am getting the following error
    Warning: compiled but with compilation errors
    Errors for FUNCTION LISTDIR
    LINE/COL                                                                       
    ERROR                                                                          
    7/3                                                                            
    PLS-00201: identifier 'DBMS_BACKUP_RESTORE.SEARCHFILES' must be declared       
    7/3                                                                            
    PL/SQL: Statement ignored                                                      
    8/54                                                                           
    PL/SQL: ORA-00942: table or view does not exist                                
    8/20                                                                           
    PL/SQL: SQL Statement ignored                                                  
    10/11                                                                          
    PLS-00364: loop index variable 'EACH_FILE' use is invalid                      
    10/2                                                                           
    PL/SQL: Statement ignored      Cheers,
    Shan

  • How to get target file name and buffer the incoming messages?

    Hi Experts
    I have one scenarion like
    I wanted to find whether is there any file existing in target folder. If it exists I dont want to overwrite it but I have to buffer the incoming messages in some queue or something like that. And when ever the request comes next time I have to send the data buffered in queue first.
    I dont want to add any time stamp for target file to avoide duplication.
    Can we do this using XI. If yes please suggest me how to achive this.
    Regards
    Sowmya

    >
    Sowmya wrote:
    > Hi Experts
    >
    > I have one scenarion like
    > I wanted to find whether is there any file existing in target folder. If it exists I dont want to overwrite it but I have to buffer the incoming messages in some queue or something like that. And when ever the request comes next time I have to send the data buffered in queue first.
    >
    > I dont want to add any time stamp for target file to avoide duplication.
    >
    > Can we do this using XI. If yes please suggest me how to achive this.
    >
    >
    > Regards
    > Sowmya
    there is no standard way to achieve this. I suggest a redesign.
    post the files to a different directory and write a script which will move the file to the required target directory only if it is not present there.

  • Log File name and path to check Excel Download

    Hi ,
    When we download a report in Excel/PDF/HTML is it logged in any log file ? What is the log file name and path?
    Regards
    Anand

    Hi...
    one of my user tried to download the report in excel format. that excel was not opening. then he tried to download the same report again. this time he was able to open thee excel.
    So he wants to investigate why this happened first time. could you please suggest how we can investigate this?
    Regards
    Anand

  • How to strip a file name and add it to array

    Hello I am new to labview, and I need to know how to strip a file name and add it to an array. For example, filename joe.csv, then take "joe" and add it to an array with other inputs. A visual depiction will be very helpful
    Attachments:
    channel read and error check R03_v9(JHK).vi ‏101 KB

    What does your code attachment have to do with your question?
    What are "other inputs"?
    I assume you have an array of strings. You can strip the filename using get file extension. You can build an array using build array. Wire the existing array on one input ant the string as a second input.
    LabVIEW Champion . Do more with less code and in less time .

  • How to get Sequence File Name ?

    Hello everybody !!
    I'm using TestStand 3.1 and i would like to get sequence file name. I've tried to use NameOf() function, but without success.
    Of course, I've searched previous posts about the same question, but nothing works.
    Is there someone able to tell me how to get sequence file name ?
    Thanks a lot.
    MrOrange

    MrOrange,
    first of all, the solution i will present only works for saved sequence files.
    you got all information you need within TestStand itself, just browse for RunState.SequenceFile.Path. here you can find the filename. but the path of the file is also included in the string, so this is a part you have to get rid off.
    you can use statements to extract the filename from the path. just search the string for the last occurence of "\\" (searchinreverse!) and then you can retrieve the right() part of the path. beware that right() needs the number of characters you want to extract, not the startindex!!
    hope this helps,
    Norbert B.
    NI Germany
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Problem with getting the file name and type from OAMessageFileUploadBean

    Hi Tapash,
    I am trying the code below to get the file name and mime type from OAMessageFileUploadBean,
    DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("Documents");
    String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
    String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    But this piece of code gives errors saying that selectValue selectValue(null, java.lang.String) not found in class oracle.svc.DataObject
    Any ideas? why this code is giving error?
    Can i handle the event of browse button for OAMessageFileUploadBean?
    Regards,
    Nagesh Manda.

    Try using class oracle.cabo.ui.data.DataObject
    --Shiv                                                                                                                                                                                                       

  • Dynamic File Name and Directory File Sender Adapter

    Hello gurus,
    I have a question: Is there any way to make the File Name, and Directory Dynamic of a File Sender Communication Channel ?
    For example, taking it as a parameter from a Web Service Request.. (I mean, the only way with this would be a ccBPM). I don't exactly know if there is a way, I just thought about this.
    Please tell me if someone could make Dynamic these 2 parameters while picking a file.
    Regards,
      Juan

    oops,thought i was replying to the PgP question:)
    I think you should be able to achieve this via adapter module but i m not really sure how exactly it will be done .
    Thanks
    Aamir
    Edited by: Aamir Suhail on Jul 28, 2009 1:42 PM

  • How to find ATL file name and timestamp of importing for existing DI code?

    A tester is not sure about the version of the ATL code which was imported into his local repository. Is there anyway he can get the imported ATL file name and/or timestamp from the repository or a log file? I searched in both places but couldn't find any information. Did I miss something? This is DI 11.5.3.
    Thanks,
    Larry

    I don't think the information about the source of how the object was created in repo is maintained anywhere, like this version of object was created from ATL or from Designer etc
    but different versions of objects are stored in AL_LANG and its language in AL_LANGTEXT table, if you have not compacted the repo, you may get the last modified time from AL_ATTR table, try getting the data from these table and see if you get any info that is useful for you

  • How to get the file name in one of the Xml node field?

    Hi Experts,
    i have one requirement with file name in xml file.
    i need to get <b>the file name of file</b> in one of the node in xml content of that file.
    how can i achieve that req?
    treat this as Very Urgent.

    Hi Bheem,
    Explain your scenario in detail..
    >>i need to get the file name of file in one of the node in xml content of that file.
    1. Create an node <b>Filename</b> in the target datatype.
    2. Check the Option Filename in the Adapter Specific Message Attributes in the sender file CC.
    3. Use the following UDF and map it to the Filename field in the target message type.
    public String getFileName(Container container)
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    return  ourSourceFileName; 
    Regards
    San

  • How to get IDL file name from CORBA IOR string

    hi, is it possible to get IDL file name from the IOR string? how?
    regards

    Hi,
    I don't think so.
    And if it was possible, which interface should be returned if
    the referenced object implements more than one?
    Regards.
    Karl

  • Need to get file name and directory back from file adapter - WRITE

    I am using the file adapter to write a file. I want to log the file name of the file we just created. Since we use a precise timestamp in the file name, I can't accurately guess.
    I have an invoke in my BPEL process to the file adapter. My first try was to assign the jca.file.FileName property to a variable, but it never comes back. I looked around and saw plenty of ways to SET the file name for a write and GET the file name for a read, but no GET file name for WRITE.
    Anyone have a solution?
    Thanks in advance!

    I think I got your point... You can tell FileAdapter the filename to write, but if you don't then FileAdapter can not tell you the filename that it wrote... I think it is pretty possible Oracle didn't implement the latter, as the write operation is probably asynchronous and the filename is calculated later on...
    If what you want is just log, you may achieve your requirement by increasing verbosity on Adapter logs... Have a look at the link bellow...
    http://docs.oracle.com/cd/E15586_01/integration.1111/e10226/ad_mon.htm#CJHHBBID
    Otherwise, the solution for you will be to calculate filename yourself, and that will be a little bit of reinventing the wheel... But at least you will know the filename...
    Cheers,
    Vlad

  • How to get the class name and field name dynamically

    Hi
    I have a class (ex: Contract) the fields (ex : a,b,c) .i need to get the class name and field name dynamically
    ex
    if( validation file for the field Contract.a){
    return contract.a;
    }else if(validation file for the field Contract.b){
    return contract.b;
    how to pass the field name and object dynamically
    Please help me .............
    Thanks in Advance..
    Edited by: 849614 on Aug 11, 2011 6:49 AM

    YoungWinston wrote:
    maheshguruswamy wrote:
    Agreed, but IMO, i still feel its best if there is no tie in between consumer class level details and the database it talks to. A service layer is needed in between them.Sounds like you've done a bit of this before. Me, I've either been a modeller/DBA, doling out data, or a nuts and bolts programmer (and actually more toolmaker than apps, but did a bit of that too).
    Do you know of a good book about the "middle ground" (ie, these service layers)? I understand it empirically, but haven't had a lot of exposure to it.
    Winston
    Edited by: YoungWinston on Aug 11, 2011 10:34 PM
    PS: Apologies. Edited my previous post, presumably while you were composing your reply, when I finally realized what '.filed' meant.Most of my work is in web development, never been a DBA :) . The biggest 'concern' in my shop is 'separation of concerns'. The UI group reports up to a different IT head, the DB group reports up to a different IT head and so on. The looser the coupling between these systems, the lesser the project costs (Integration, QA etc) are. Martin Fowler's books contain good information about separation of concerns in an enterprise environment. The two books which i recommend are
    [url http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420]Enterprise Application Architecture and
    [url http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/ref=pd_sim_b_1]Enterprise Integration Patterns

  • How to get all property names and values of an bean instance at runtime?

    How can I get all property names and values of an bean instance at runtime?
    (The class of the bean instance is dynamic and I can not know before I write the code .)

    Look at Class. It has a way to get at all public methods and attributes.
    If you need to get to private attributes you can do what the Introspector does and expect the methods to follow the Bean pattern and pull the attributes out based upon that. Privates are all hidden from direct access but through the Bean Pattern they can be figured out.

Maybe you are looking for

  • Print a report from Application Express direct to a CUPS Printer

    Hi all, I'm new to this technology, is it possible to print a report from Application Express directly to a CUPS Printer? Can someone tell me in laymans terms how to do it? I find the terminology and documentation less than helpful.

  • Global keyboard binds once again - actkbd? Or?

    Hello, I'm trying to fix some "not-only-x" binds, since I'm kind of forcing myself to learn more linux in not only clickable way. I'm looking for an app or a tip how and what. Read this great forums and wiki, but still I've got some questions. I like

  • Unable to install itunes update- says "trying to use an unavailable network resource"

    Hello- I have been trying to update my itunes on my HP laptop, but it has not allowed me to. I have been on the phone with people trying to figure it out but they said that I would need to contact apple to get the solution. before i get put on hold f

  • My New iMac and hotmail

    Hey everyone!!! I got my New iMac .. I am really glad of it so far. One thing i realized that isnt really making me happy though. When i access my email messages from msn messenger it never signs in. It opens hotmail but everytime i sign in it just g

  • Load Balancing TMG 2010

    hi, i use 2 tmg's with sp2. no active directory, hance no tmg array. i want to enable microsoft load balancing on the internal and external but i always get "RPC is not ..." although i have opened the correct ports. i have managed to establish a load