Log4j Can't rename file

Hello,
I have logger:
static Category lg = Category.getInstance(Mycls.class.getName());
it gets proprtys:
log4j.rootLogger=DEBUG, console, logfile
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d %-4r [%t] %-5p %c %x - %m%n
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.File=my.log
log4j.appender.logfile.Threshold=INFO
log4j.appender.logfile.MaxFileSize=1000KB
log4j.appender.logfile.MaxBackupIndex=10
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d %-4r [%t] %-5p %c %x - %m%n
I need to rename log file with date included in filename. But it should happen according to my request. This is the way I'm trying to do so:
          SimpleLayout layout = new SimpleLayout();
          DailyRollingFileAppender appender = null;
          try {
          appender = new DailyRollingFileAppender(layout,"my.log","'.'yyyy-MM-dd-HH-mm");
          } catch(Exception e) {}
          lg.addAppender(appender);
Unfortunatedly I have message 'log4j:ERROR Failed to rename [my.log] to [my.log.2005-10-27-18-11].
Would you be so kind to help me solve this problem?

Depending on you O/S if the file is still open you will not be able to rename it. I'm not sure how to close a log in log4j but I'd start with that - close it and then rename it.

Similar Messages

  • Can't rename files on an external harddrive,

    I import my pictures into Lightroom using the following format YYYYMMDD - XXXX.  For example, a picture with a file number 2113 taken on Dec 16th, 2011 would be ranamed 20111216 - 2113.  I import them to my computer first and then move them to an external hard drive when the storage on my computer gets tight.  For a while, I accidently was adding a space to the front of my file name, so it would import as " 20111216 - 2113" instead of "20111216 - 2113"  notice the space at the beginning file name.   This space was maintained when the file lived on my computer, but it was removed when I moved the lightroom folder to my external hard drive.   As a result, all of the files that are on the external hard drive show up as "missing or deleted."  Light room thinks there should be a space in the front, but none of the files on the hard drive do.  I have to locate each and every file by hand, and the "find nearby photos" check box doesn't help, because all the files are missing the space.   Is there a way to batch rename files in lightroom, even when the file is missing?  I need to change all the names in my catalogue to take out the space at the front so I can then easily locate the files on my external hard drive.   Can someone help me out?  There has to be a better, faster, easier way to do this other than individually locating each and every file on my external hard drive.
    Thanks for your help,
    matt

    Lightroom can't rename files while they're missing.  If you batch rename the files on the external hard drive, to include the space again, LR should find them and then you can rename them within LR to remove the space again.

  • How can I rename files without creating a duplicate?

    How can I rename files without creating a duplicate?  And secondly, for some reason I can no longer save pdf files [i.e., bank statements] where I want - the Save As function is gone?

    In many new cases, Save As is now called Duplicate in ML. It uses the same command-S keystroke. Older apps still have Save As. When you do a Duplicate operation, you will create an UNTITLED document. You have to save that duplicated document to complete the process.
    So in 10.6.x, you would do ...
    * Save As ...
    * Give the file a new name + Chose the location for the file
    * Click the Save button
    Now in 10.8.x, you do ...
    * Duplicate ...
    * Save ...
    * Give the file a name + Chose the location for the file
    * Click the Save button
    As baltwo mentioned, you have to search the Preferences of your browser to determine what is has set for the default Download folder.
    JJW

  • Can't rename file with Applescript

    Hi,
    I'm a programmer but I'm new to Automator and Applescript. I am trying to rename pdf files based on a specific line of its content but I don't succeed. I created a service that exports the text from the pdf to a file. Then I use applescript to read that specific line from the file, then another applescript to rename the pdf to that string. Every step works except the rename part. When I tell Finder to rename the file it stops with the error: "The operation can't be completed because there is already an item with that name." This is not true, but I keep getting this error message no matter which file I try it with.
    The odd thing is that if I set varName to some constant like
    set varName to "METEOR CEE Kft..pdf"
    it works like a charm. So I figured maybe
    item 1 of input & ".pdf" = "METEOR CEE Kft..pdf"
    is false. But that is not the case, I tested it in the script and they are equal.
    What am I missing?

    I think that the problem is that there is a lot of invisible characters in the text file when Automator extracts a PDF to plain text (open the file in a text editor and turn on "view invisible characters", or use cat -e in Terminal)
    I've gotten around this is the past by extracting to a RTF and then using textutil to convert to txt
    Try this Automator Workflow:
    The bash script is:
         textutil -convert txt "$1"              # Convert from RTF to TXT    
         n=$( sed -n '9 p' "${1%.*}.txt" )         # extract line 9 fron text file
         mv "${1%.*}.pdf" "${1%/*}/$n.pdf"     # Rename file
         rm "$1" "${1%.*}.txt"                         # Clean-up RTF and TXT files

  • Can't rename file under Subversion control.

    CS5 - Unless I'm missing something you can't rename a file (using dreamweaver to do so) and have it maintain it's connection to subversion. For example, if I rename a file using Dreamweaver, edit it, then go to "Commit" it, I get an error "File is not under Subversion Control". What is the correct way to rename a file in CS5 under subversion control?
    This is a serious deficit.

    Saving the file under a different name creates all sorts of problems. Especially since all the history of the changes are lost. DW provides a "rename" command but it doesn't update the files svn metadata. If you use the rename command it doesn't warn you that you will loose the connection to the repository.
    This must be a bug because an equivelent version of Tortise SVN DOES allow you to rename a file and preserve all the history. I just found this out and am using Tortise SVN to do the renaming. It's the same SVN version as DW so it updates the metadat just fine and it preserves the history of the previously named file.
    This is a bug in DW or a serious omission.

  • Can't rename files on my mac?

    i can't rename any files on my computer anywhere. i have tried switching the permissions as well to read and write but that doesn't work at all!
    please help

    So describe the process you go through to rename a file. Step by step.

  • How can I rename files when importing?

    Is there a way to rename files when importing them? Every method I've tried retains the original file name the camera assigns (e.g. DSC_0001). I'd like the ability to rename the files automatically either with a date or event name with sequential numbering following.
    Thanks!

    First you will have to upload from the camera to a folder on the Desktop where you can batch rename them before importing into iPhoto. That's a safer workflow IMO because you can make sure the photos are safely on the hard drive before starting any other operation.
    OT

  • Can't rename files on ipod

    I am sorry if this is a repeat question. I have searched for 1.5 hours here and have not found what I was looking for.
    I copied episodes of TNG onto my (PC)laptop. I dragged them into my iTunes. They play great. I just can't rename them on the ipod. When they are copied (manually) onto the ipod, they lose their names and show up as Title01_01 rather than "Yesterday's enterprise" or whatever...
    They DO play on the iPod -- I just want to know WHICH ONE I am playing! Thanks.
    dell inspiron   Windows XP Pro   Cucusoft converter

    OK-- Here's what I did.
    I changed everything to manual transfer. I deleted my videos and reconverted them again. I dragged them AGAIN into itunes. I had to change the names by hand in iTunes-- and then, if I click on them with the new name, it goes back to the title0101 etc. So, I have not tried putting anything onto my iPod again -- (I am in the middle of an audiobook and don't want to lose the place!) If anyone's interested in how this comes out, I'll be glad to post back when I do add this to the iPod.
    peace out.

  • Can't rename files on my external hard-drive.

    I have a Seagate Backup Plus drive hooked up to my Macbook Pro with some video files I want to rename and organize on it, but when I click a file, I cannot preview it in finder.  I have to double click and open it up in Quicktime.  If I click "get info" I can preview the videos and rename them, but I'd much rather do it in Finder.
    Any ideas?
    Thanks!

    Whether it can fixed or not depends on how the drive is formatted. If it is FAT32 you may be out of luck, but if it is in a standard Mac format you should be able to fix it. Take a look at this thread:
    http://discussions.apple.com/thread.jspa?messageID=5908325
    For FAT32 I have been unable to find any information at all on either the cause or a solution.
    Francine
    Francine
    Schwieder

  • Can't rename file in Bridge CS6 after update

    I recently did an update to bridge CS6, after that I can no longer rename the files in bridge and I don't see the file and format name under the image like I use to. How do I get it back??!! I HATE THIS UPDATE.
    Please help!! Thanks!

    Nevermind I figured it out!
    Now how do I delete this question???
    Thanks!

  • Can't rename file name under Finder even as an administrator.

    As an adminstrator to my MacBook Pro, why can't I rename certain file name  under Finder?

    Have you tried running lsof from the Terminal?
    Lsof will show you any files that are open, the likelihood is that your file is in use.

  • Can't rename files/folders after changing extension of a file

    This has gone on for a while and is quite the pain.
    So I need to change the extension of a file. I change it, it asks me do I really want to do this, and I do. Sometimes immediately, and sometimes in a while, I lose the ability to rename a file/folder - I highlight it but can't type anything. Only a restart cures it, until the next round. Really annoying.
    I've seen this syndrome posted here and there, but no real solutions. Any ideas welcome, I'm using 10.4.11 btw.
    Thanks

    Very Important, how much Free Space is on your Hard Drive first of all? Click on the Macintosh HD on the Desktop, then do a Get Info on it.
    First, Safe Boot , (holding Shift key down at bootup), use Disk Utility from there to Repair Permissions, test if things work OK in Safe Mode.
    Then move these files to the Desktop...
    /Users/YourUserName/Library/Preferences/com.apple.finder.plist
    /Users/YourUserName/Library/Preferences/com.apple.systempreferences.plist
    /Users/YourUserName/Library/Preferences/com.apple.desktop.plist
    /Users/YourUserName/Library/Preferences/com.apple.recentitems.plist
    Reboot & test.

  • Can't rename files

    Before 10.5.8, I used to be able to click on a file's icon name (the text) and it would highlight it, allowing me to change it's name. Now in 10.5.8, anytime I single click on an icon's text it just opens the file (no more name changing allowed). Anybody else having this problem ? Please help, as the only workaround I've found is to hit "Get Info" and switch file names from there. Kinda clunky...

    I got a very similar problem in 10.6.1. Only with newly created folders on network drives. Gives an error that I do not have the permission to rename it. I check it with ssh on the Linux/Samba server and I do have the permission. Well, I just created it, I can open and delete the folder but not rename.
    Now thanks to your question I tried renaming it via "Get info" and that works. Clearly a bug in Finder I would say. Hopefully, Apple can fix that soon.

  • Can you rename files in Bridge and relink in InDesign automatically?

    I have a 250+ page InDesign file with 800+ links to images.
    The problem I'm having is the images have French file names.  I want to remove the French text and rename the images to English.
    If I rename the images in Adobe Bridge will the Indesign links remain?
    I'm using CS5.5

    Unfortunately no.
    But fortunately there's a script!
    http://carijansen.com/2011/11/10/indesign-epub-support-tool-renaming-image-links/

  • How can i rename files on NTFS external hard drive???

    I cinnected my NTFS external hard drive to my MacBook and i tried to rename some of the files but there wasn't this possibility!I never had a mac before so these is all new to me!The problem is that my external HDD is full and i cannot format it to FAT32! Is there any other solution except using 3rd party applications?Thank you!

    OS X cannot write to an NTFS formatted drive without third-party software to enable the feature. Go to
    MacUpdate or CNET Downloads  and search for NTFS to find alternatives. However, be aware that most will not work compatibly with Lion.

Maybe you are looking for

  • Issue Applying Simple Links In SharePoint 2013

    Having recently migrated a site from 2010 to 2013, I have now started enhancing existing pages whilst adding new one's also. However, I am unable to add basic links to either text or graphics in 2013? This is frustrating and bizarre. Typically, I cre

  • I have a Sony Bravia KDL46W905 TV but I can't get it to connect the Airport Extreme router

    My Sony Bravia KDL46W905 TV won't connect to my Airport Extreme router and the internet. It recognises and picks up my home wireless network though and I'm inputting the correct password but still won't connect. The router is set to WPA2 Personal. An

  • Controlling content height in the scrollpane component

    I'm using the scrollpane component to display content, within the content movie clips, are swf animations that are being imported using targets. Some of the animation's parts go far beyond the height of the stage, causing the scrollpane to adjust for

  • OS X app FCE suddenly needs classic?

    Having clicked on a very suspicious unmarked download on the internet (Clicking a thumbnail for a picture instead got something that downloaded and then tried to start setting up an unknown ISP.), I decided it would be safest to just wipe my hard dri

  • Force Publish

    i want to force iweb to publish everything from scratch but since i haven't updated the sites in iweb it won't let me publish. background i tried to publish from iweb on another computer to my .mac and it changed the index.html file and added another