Log4j file appender

Hi,
I am using log4j for logging. I am working on a huge application and there would be lots of logs each day. Thereby it is requried that the log files be stored and renamed each day. The date is appended to the log file and that day's log file is stored. The logs start writing afresh each day. The problem here is that at times the application simply starts logging to the previous day's log file, for a while, and then starts writing back to the current day's file again. I am not able to figure out what goes wrong and when. The application is running on weblogic. Can anybody please help? The log4j properties file is here....
# DO NOT MODIFY
log4j.categoryFactory=com.myapp.util.logger.LoggerCategoryFactory
log4j.rootCategory=INFO,DISABLED
# EVENTS
log4j.category.nmy.STATE=INFO,0,DAY,OBS
log4j.category.nmy.EXCEPTION=DEBUG,10,DAY
log4j.category.nmy.SESSION=INFO,0,DAY
log4j.category.nmy.REQUEST=INFO,0,DAY
log4j.category.nmy.MESSAGE=INFO,0,DAY
log4j.category.nmy.OBJECT=INFO,0,DAY
log4j.category.nmy.DATA=INFO,0,DAY
log4j.category.nmy.NONE=DEBUG,5,DAY
# DO NOT MODIFY
log4j.appender.DISABLED=com.myapp.util.logger.NullAppender
# STANDARD OUTPUT DRIVER SETTINGS
log4j.appender.CON=org.apache.log4j.ConsoleAppender
log4j.appender.CON.Target=System.out
log4j.appender.CON.layout=com.myapp.util.logger.LoggerLayout
log4j.appender.CON.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
# ROLLING FILE OUTPUT DRIVER SETTINGS
log4j.appender.ROL=org.apache.log4j.RollingFileAppender
log4j.appender.ROL.File=/var/opt/apps/myapp/var/logs/application.log
log4j.appender.ROL.MaxFileSize=4000KB
log4j.appender.ROL.MaxBackupIndex=5
log4j.appender.ROL.layout=com.myapp.util.logger.LoggerLayout
log4j.appender.ROL.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
# DAILY OUTPUT DRIVER SETTINGS
log4j.appender.DAY=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DAY.File=/var/opt/apps/myapp/var/logs/daily_application.log
log4j.appender.DAY.DatePattern='.'yyyy-MM-dd
log4j.appender.DAY.layout=com.myapp.util.logger.LoggerLayout
log4j.appender.DAY.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
# ===========================================================================
# SIMPLE FILE OUTPUT DRIVER SETTINGS WITH DEBUG_INFO
log4j.appender.FIL=org.apache.log4j.FileAppender
log4j.appender.FIL.File=/var/opt/apps/myapp/var/logs/fil_application.log
log4j.appender.FIL.Append=false
log4j.appender.FIL.layout=com.myapp.util.logger.LoggerLayout
log4j.appender.FIL.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
# ===========================================================================
# DAILY OBSERVATION FILE OUTPUT DRIVER SETTINGS
log4j.appender.OBS=org.apache.log4j.DailyRollingFileAppender
log4j.appender.OBS.File=/var/opt/apps/myapp/var/logs/obslog.out
log4j.appender.OBS.DatePattern=.yyyyMMdd
log4j.appender.OBS.layout=com.myapp.util.logger.LoggerLayout
log4j.appender.OBS.layout.ConversionPattern={DESCRIPTION}
# log4j.appender.OBS.layout.ConversionPattern=+{DATE_TIME};{EVENT_ID};{SESSION_ID};{SEVERITY};{MODULE};{THREAD_ID};{EVENT_TYPE};{ERROR_CODE};{DESCRIPTION};{DEBUG_INFO}
Regards...

I found from the log4j 1.3 API javadoc, the DailyRollingFileAppender is deprecated. They use the RollingFileAppender instead and give one sample .
Hope it helps!
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration>
<log4j:configuration debug="true">
<appender name="ROLL" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/wombat/foo.%d{yyyy-MM}.gz"/>
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%c{1} - %m%n"/>
</layout>
</appender>
<root">
<appender-ref ref="ROLL"/>
</root>
</log4j:configuration>

Similar Messages

  • Log4J - file appender (2/more file for same package/class)

    Hi All,
    My requirement is i want to create 2 log file for same package.
    EG: com.foo.bar
    my code:
    log4j.rootCategory= ALL, fileAppender,stdout
    log4j.appender.fileAppender=org.apache.log4j.RollingFileAppender
    log4j.appender.fileAppender.File=c:\\temp\\test.log
    log4j.appender.fileAppender.MaxFileSize=64KB
    log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.file1=org.apache.log4j.RollingFileAppender
    log4j.appender.file1.File= file1.log
    log4j.appender.file1.MaxFileSize=64KB
    log4j.appender.file1.MaxBackupIndex=1
    log4j.appender.file1.layout=org.apache.log4j.PatternLayout
    log4j.appender.file1.layout.ConversionPattern=%p %t %c - %m%n
    log4j.appender.file2=org.apache.log4j.RollingFileAppender
    log4j.appender.file2.File= file2.log
    log4j.appender.file2.MaxFileSize=64KB
    log4j.appender.file2.MaxBackupIndex=1
    log4j.appender.file2.layout=org.apache.log4j.PatternLayout
    log4j.appender.file2.layout.ConversionPattern=%p %t %c - %m%n
    log4j.appender.file3=org.apache.log4j.RollingFileAppender
    log4j.appender.file3.File= file3.log
    log4j.appender.file3.MaxFileSize=64KB
    log4j.appender.file3.MaxBackupIndex=1
    log4j.appender.file3.layout=org.apache.log4j.PatternLayout
    log4j.appender.file3.layout.ConversionPattern=%p %t %c - %m%n
    // THIS IS FOR ClIENT
    log4j.logger.com.ls.es.service=DEBUG, file1
    // THIS IS FOR SUPPORT
    log4j.logger.com.ls.es.service=DEBUG, file2
    // THIS IS ERROR MESSAGE
    log4j.logger.com.ls.es.service=ERROR, file3
    Here file1 is for Client(Client Admin)and file2 is for Support.
    but am getting only file3.log file which is for Error Message..
    some where configuration is missing...
    Thanks,
    by
    dhana

    I have created a class that allow to create easily new logs:
    1.- Switch the Root Logger output
    2.- Create as many logs as desired (I build a simple web server, each new client has a log associated to it).
    Main problem: code and comments in spanish.
    Are you intereseted on it? Let me know, I can send it to you by mail.
    Cesar

  • Log4j Logger and File appender

    I have a problem with my logger file. It look like this :
    # appender "file" writes to a file
    log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.file.File=src/logs/test.log
    log4j.appender.file.layout=org.apache.log4j.PatternLayout
    log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    log4j.appender.file.threshold=DEBUG
    The problem is when I write to the logfile test.log. The contents of the previous "run" is still there. What I want to achieve, is whenever I run my application, only the content of that "run" should be present on the logfile.
    What to add ?
    Cheers !

    It works fine now. I only had to add the line :
    log4j.appender.file.append=false
    so now it look like :
    # appender "file" writes to a file
    log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
    log4j.appender.file.File=src/logs/babel.log
    log4j.appender.file.append=false
    log4j.appender.file.layout=org.apache.log4j.PatternLayout
    log4j.appender.file.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
    log4j.appender.file.threshold=DEBUG

  • Log4j async appender and line number output

    Hello,
    I am trying to implement log4j in my application, and would like to log the caller class and the line number of the call. When I do not use async appender, the caller class and the line number are logged. However when I add the same appenders to the AsyncAppender, the caller information is lost. Please, take a look at the config and output snippets.
    Thanks,
    Elana
    ======
    Here is the configuration without the use of the async appender (Async tags are commented out)
    <log4j:configuration debug="true">
    <!-- <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
        <appender-ref ref="SystemOut"/>
        <appender-ref ref="FileOut"/>
      </appender>
       -->
      <appender name="SystemOut" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern"
                 value="%5p (%d{DATE}) [%t] (%F:%L) - %m%n"/>
        </layout>
      </appender>
      <appender name="FileOut" class="org.apache.log4j.RollingFileAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern"
                 value="%5p (%d{DATE}) [%t] (%F:%L) - %m%n"/>
        </layout>
        <param name="File" value="logs/exampleAsync.log"/>
        <param name="MaxFileSize" value="100KB"/>
        <param name="MaxBackupIndex" value="1"/>
      </appender>
      <root>
        <!--<appender-ref ref="ASYNC"/>       -->
          <appender-ref ref="FileOut"/>
          <appender-ref ref="SystemOut"/>
      </root>
    </log4j:configuration>It produces the following output:
    DEBUG (08 Apr 2006 17:03:49,140) [Thread-0] (LogGenerator.java:79) - Debugging
    DEBUG (08 Apr 2006 17:03:52,145) [Thread-0] (LogGenerator.java:74) - TracingHere is the configuration WITH the use of async appender
    <log4j:configuration debug="true">
      <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
        <appender-ref ref="SystemOut"/>
        <appender-ref ref="FileOut"/>
      </appender>
      <appender name="SystemOut" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern"
                 value="%5p (%d{DATE}) [%t] (%F:%L) - %m%n"/>
        </layout>
      </appender>
      <appender name="FileOut" class="org.apache.log4j.RollingFileAppender">
        <layout class="org.apache.log4j.PatternLayout">
          <param name="ConversionPattern"
                 value="%5p (%d{DATE}) [%t] (%F:%L) - %m%n"/>
        </layout>
        <param name="File" value="logs/exampleAsync.log"/>
        <param name="MaxFileSize" value="100KB"/>
        <param name="MaxBackupIndex" value="1"/>
      </appender>
      <root>
        <appender-ref ref="ASYNC"/>
      </root>
    </log4j:configuration>It produces the following output: (NOTE the question marks in the place of caller info)
    DEBUG (08 Apr 2006 17:12:12,534) [Thread-1] (?:?) - Tracing
    DEBUG (08 Apr 2006 17:12:15,528) [Thread-1] (?:?) - Debugging

    I don't think you can use AsyncAppender with a properties file. You have to use XML and a JoranConfigurator

  • File append

    Hi !
    I have a file log.txt. I want to add data to this file at the begenning without deleting the previously present data in log.txt.
    How can I do this ?

    Append to the end of this file:
    boolean append = true;
    FileOutputStream out = new FileOutputStream(file, append);The data isn't added to the beginning of the file, you say? Look at the file from a different point of view, says I.
    And if you are logging, there are better ways to do it: {color:orange}http://logging.apache.org/log4j/1.2/index.html{color}

  • Log4J Asynchronous appender

    hi
    any one can help me how can i use " Log4J Asynchronous appender" in my project.
    cureently i am using Log4J appender for logging using the property files

    Your question is a bit hard to understand, but if you mean you have the configuration of Log4J in property files today (using PropertyConfigurator) there is no way to use the AsyncAppender.
    The AsynAppender ( [http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AsyncAppender.html] ) requires xml configuration (DOMConfigurator):
    Important note: The AsyncAppender can only be script configured using the DOMConfigurator. - Roy

  • OSB File append

    I have setup a File protocol based Business Service in OSB. This Business Service is called by a Proxy Service after setting the file name in the outbound transport header and assigning the text to be written to the file. When executed, the file is successfully created. When the proxy service is executed again, a new file is created. I would like the data to be appended to the existing file. How do we achieve this?
    I know there is a property - 'Append' which should be set to true in case of file adapters. I tried setting the outbound transport header to 'Append', 'append', 'jca.file.append', 'jca.file.Append'. None of these seem to help.

    Thanks for the link. That really helped!
    However, though the file is created by the file adapter, the contents are missing. While configuring the File Adapter in JDev, I defined the following XSD as the message for the write operation.
    <xsd:element name="log">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="logMessage" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    And I am sending the following in the SOAP Request...
    <log:log xmlns:log="http://myNS/LogFileWriter">
    <log:logMessage>My Log message...</log:logMessage>
    </log:log>
    I expect the value 'My Log message...' to be written to the file. However, it is always empty.

  • Use of log4j files

    hello ppl,
    I am presently working with Oracle 10g server fr deploying my servlet programs. can u tell me the use of log4j files used in it.

    hi :-)
    i dont get much of your question
    but log4j is for logging.
    their are many benefits of log4j
    like categorize of log depending on the message
    like info, error or warn.
    it can be also configure to have DailyRollingFileAppender,
    it means it will create a log file every day
    ex.
    yourappsserver.log.2006-02-01
    yourappsserver.log.2006-02-02
    yourappsserver.log.2006-02-03
    regards,

  • ODI - IKM SQL to File Append - Header not Generated

    I'm using ODI IKM SQL to File Append to create a text file, but the header is not being generated. And the GENERATE_HEADER is set to Yes. The file is Tab delimited and the Heading (number of lines) is set to 1.
    Seems to only be an issue with HFM files coming from the Unix server.
    Any suggestions?
    Thanks, Mike

    Ok, getting the following error in step 6 - Integration - HFM_EA_Translate - Insert Column Headers
    java.lang.NumberFormatException
         at java.math.BigDecimal.<init>(BigDecimal.java:459)
         at java.math.BigDecimal.<init>(BigDecimal.java:728)
         at com.sunopsis.sql.SnpsQuery.updateExecStatement(SnpsQuery.java)
         at com.sunopsis.sql.SnpsQuery.addBatch(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:662)
    The last two columns in the file are numeric which seems to be causing the issue. Will change formatting for the two columns (String, Numeric, etc.) to see if I can resolve the header issue.
    Thanks,
    Mike

  • Log4j JDBC Appender for MDB

    Hi,
    I'm having problems using Log4j JDBC Appender for my MDB. When I deploy my MDB to JBoss I get an error saying that the database connection could not be created due to too many connections. I have set my minimum database connections to 150 in mysql-ds.xml and I have 50 instances of MDBs but still I have this error. This occurs only once during start up. I'll be investigating this but if there's anyone who has encountered a similar scenario, I'd be happy to hear your comments.
    Thanks!

    4/21/10
    The new Windows 2008 R2 server came in yesterday.  I installed CF9 and downloaded the HXTT JDBC driver.  It does seem to work but the evaluation version of the driver is limited to 1000 records.  So I am not sure if the performance is going to be ok. 
    Do I risk the $370 to get a full working version.  Will my boss think I am nuts for buying software from a company in China?
    4/28/10 - The boss says do it.
    5/1/10
    Results look good.  Everything seems to work.  Performance might even be better than the jet 32 bit drivers.
    5/10/10 - First issue found
    The MS Access "Make Table Query" that uses non-standard syntax   SELECT * INTO Target FROM Source   does not work in the HXTT driver.  This syntax worked with both Access Jet and CF8 32 bit drivers.  So it looks like I will be forced to make some code changes.  INSERT INTO Target SELECT * FROM SourceTable   looks like the best bet.

  • Log4j file name formatting

    I have certain logging requirements to meet, and log4j was chosen as the logging API of choice. I can do the appenders & loggers, and rolling files and all of that, however, we have requirements on how the files themselves should be named.
    ${user.home}/logging/process-name/ip-address/log.xml.{date}
    I can do the ${user.name} and append the date to the end using DailyRollingFileAppender. However, i see that when creating a logging message, you have access to a lot of data, such as the process id (or thread id), the ip address and whatnot, however, I need that information for file naming. Is this possible?
    Thank you
    Diane

    yaniv1977 wrote:
    Hi
    I hava some servers that use log4j to log in shared folder.
    i want that every server will create his own log file with his host name.
    I'm using log4j.xml to configure the appender and I want to use variable to create dynamic file name.
    Could it passible?
    And what happens to your distributed enterprise system when that shared folder is not available?

  • Reading in a txt file, appending numbers to it.

    So I'm a student at Georgia Tech working on a relatively simple Java program for a research internship, but it's been awhile since I've had my Java course and I'd really like some help on this. Basically, what I'm looking to do is to take in a text file with data that only consists of the numbers 1,2,4 and 5, with up to four digits in each line and no number may be repeat itself in the same line. A sample of data would look like the following:
    12
    21
    154
    2
    1
    45
    24
    4125
    Lines like '12' and '21' would count as the same however, as would '4512' to '1245'. I'm trying to determine how often each number 'interacts' with each other number, and then append that data to the end of the text file by saying something along the lines of:
    One-Two Interactions = 4
    Four-Five Interactions = 6
    Etc. etc. The real problem I'm having is I can't remember how to get the BufferedReader to 'identify' the particular numbers and combinations of numbers before adding to the count in each variable. If you have any advice or answers, it would be greatly appreciated.

    import java.io.*;
    import java.util.*;
    public class ExchangeProgram{
         public static void main(String[] args) {
              int one = 0;
              int two = 0;
              int four = 0;
              int five = 0;
              int one_two = 0;
              int four_five = 0;
              int one_four = 0;
              int two_five = 0;
              int four_two = 0;
              int one_five = 0;
              int one_two_four = 0;
              int two_four_five = 0;
              int one_two_five = 0;
              int one_four_five = 0;
              int all = 0;
              Set h = new HashSet();
              File file = new File("test.txt");
    StringBuffer contents = new StringBuffer();
    BufferedReader reader = null;
    try
    reader = new BufferedReader(new FileReader(file));
    String text = null;
    // repeat until all lines is read
    while ((text = reader.readLine()) != null)
                             h.add(text);
    } catch (FileNotFoundException e)
    e.printStackTrace();
    } catch (IOException e)
    e.printStackTrace();
    } finally
    try
    if (reader != null)
    reader.close();
    } catch (IOException e)
    e.printStackTrace();
              for (int i=0; i>h.size(); i++){
                        if (h.contains("1")){
                             one++;
                        if (h.contains("2")){
                             two++;
                        if (h.contains("4")){
                             four++;
                        if (h.contains("5")){
                             five++;
                        if (h.contains("12")){
                             one_two++;
                        if (h.contains("45")){
                             four_five++;
                        if (h.contains("14")){
                             one_four++;
                        if (h.contains("25")){
                             two_five++;
                        if (h.contains("42")){
                             four_two++;
                        if (h.contains("15")){
                             one_five++;
                        if (h.contains("124")){
                             one_two_four++;
                        if (h.contains("245")){
                             two_four_five++;
                        if (h.contains("125")){
                             one_two_five++;
                        if (h.contains("145")){
                             one_four_five++;
                        if (h.contains("1245")){
                             all++;
    // show file contents here
    System.out.println(one_two);
    Here's what I've come up with so far, though I'm getting this error: Note: Recompile with -Xlint:unchecked for details.
    Any comments on any major mistakes I'm making here? Haven't used the Set interface much before.

  • Multiple flat files appended, is file locked until all processed?

    Hi All,
    Have a scenario in place where we are collecting multiple flat files on ECC and using append mode on the receiver file adapter to create a single file for final output. We are only interested in submitting the output to it's target after all files sent to PI have been appended.
    Does PI 7.0 lock the appended file until all files have been appended so I am sure I end up with a complete single file on output? If not, what are my options to ensure a completely appended file is output? Would it be a viable option to pass the appending file through another sender file adapter using 'msecs to wait before modification check'?
    Thanks!
    Don
    Edited by: donald.meredith on Dec 1, 2011 2:31 PM

    How many files are you collecting from ECC and appending at receiver side and how much time it is taking to complete the process?
    if its possible to schedule your business to read data from FTP after completing append then no worries, else sometimes it creates trouble.
    The option you mentioned is reliable one , but you ended up creating one more interface.
    Regards,
    Raj

  • Regarding file append

    Hi Guys,
    I have a requirement to append a file from 2 files.
    I mean, i have 2 files at my source and i need that 2 files as one file in target.
    so iam using 2 sender communication channels to pick 2 files from source and 2 communication channels for target. one receiver channel to create a file and another communication channel to append to the first file.
    file A
    file B from Source
    and File C in the receiver
    channel1 to pick file A source file name "A.txt"
    channel2 to pick file B source file name "B.txt"
    channel3 to create file C target file name "C.txt"
    channel4 to append to fileC target file name "C.txt" with append mode.
    After all the efforts i found file B is not appending to file C.
    Note: all the 3 files have same structure.
    I dont want to use BPM
    Guys, Please suggest. Productive solution is highly appreciated..
    Thanks,
    Madhu

    Hello Madhu,
    What is the criteria (Processing Sequence) to pickup the files from Source Directory? (By Name or Date)
    Select accordingly in the sender File CC with wild card entry (*.txt) for File Name convention.
    Also In the Sender File CC, use EOIO as QOS which ensures the correct order of execution.
    In the receiver CC, use Append as file construction mode.
    So one File Sender CC & one File Receiver CC required is enough for your requiremet.
    Thanks,
    Gujjeit.
    Edited by: Praveen Gujjeti on Feb 2, 2009 10:53 AM

  • Binary file appended instead of created

    I have two machines for data acquisition. The first computer (labview 8, 2.8GHz, 1GB ram) contains a pci-6133 and pci 6052e. I am using the 6133 card to acquire 8 analog inputs at 50kHz  and the 6052E to generate a trigger pulse.  On the second computer (labview 8, 2GHz 512MB ram) I have a pci-6602 that I am using to acquire two channels for buffered event counting.  I  export the sample clock from the second computer to the first and have them both started on the same trigger.  Since I need the files on both computers to be referenced to each other, I generate a timestamp and convert it to a string. Then, using the shared variable engine I share the string between both computers for use in generating filenames. For example, I concatenate "Tracking_","<timestamp>",".dat" on the first computer and "Spectrum_", "<timestamp>", ".dat" on the second computer. Whenever I stop and start the data acqusition I want a new file created on each computer with the correct filename.
    I set the open/create/replace vi to "create only" on both computers.  When both computers are running, computer two successfully creates a new file with the correct filename and saves the data until the acquisition is stopped. However, with both computers running, computer one only creates a file once after I initially start the vi. When I stop the data acquisition and restart it (without stopping the vi), computer one appends the new data to the previous file and no more new files are created.
    When only computer one is running (and I generate the sample clock from a spare counter) , the code works correctly.  A new file is created when the data acquisition is stopped and started.
    From the symptoms, it would seem to be a problem with the use of the shared variable engine but I am not sure how. Any help on this problem would be appreciated.

    Without a look at your code, I am correct in understanding that the filestamp from the shared variable will 'name' the file?
    In that case make sure you get a 'new' timestamp.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

Maybe you are looking for