|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
[AMPL 1820] Appending to logfile?Is there a way to specify that AMPL *append* to a logfile? I've checked the FAQ and AMPL book but can't seem to find a solution to this. My apologies if I've missed it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1830] Re: Appending to logfile?Use ">> filename" to append the output of a command to a specified file. Actuallly "> filename" also appends the output of a command to a specified file, except when the file has not yet been opened -- when it has not been written previously in the AMPL session. In that case "> filename" causes the file to be overwritten. Bob Fourer 4er@... > -----Original Message----- > From: ampl@... [mailto:ampl@...] On Behalf Of > Jacob JKW > Sent: Wednesday, June 11, 2008 6:44 AM > To: AMPL Modeling Language > Subject: [AMPL 1820] Appending to logfile? > > Is there a way to specify that AMPL *append* to a logfile? > > I've checked the FAQ and AMPL book but can't seem to find a solution > to this. My apologies if I've missed it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1839] Re: Appending to logfile?On Jun 12, 8:55 pm, "Robert Fourer" <4...@...> wrote: > Use ">> filename" to append the output of a command to a specified file. Although I have found a way around this (I'm just constantly creating new log files based on the time), this does not appear to work with writing to with writing logfiles under Windows Vista: -------------------- Start Example -------------------- ampl: model; ampl: option log_file (">>foo.txt"); Error executing "option" command: can't open ">>foo.txt" ampl: option log_file (">> foo.txt"); Error executing "option" command: can't open ">> foo.txt" ampl: option log_file (">>" & "foo.txt"); Error executing "option" command: can't open ">>foo.txt" ampl: -------------------- End Example -------------------- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1843] Re: Appending to logfile?Don't include >> as part of the log file's name. So for example you could use any of the following forms: option log_file >> ("foo.txt"); option log_file >> "foo.txt"; option log_file >> foo.txt; In the first of these, you can use any AMPL string expression in place of "foo.txt" inside the parentheses. Note that these will only append the output from the "option log_file" command to file foo.txt, however. If you want to append output of other commands, you will have to follow them with ">> ..." as well. If you just want to define a log file to which all results of AMPL commands are written, then don't use >> in the option log_file statement: option log_file ("foo.txt"); option log_file "foo.txt"; option log_file foo.txt; You may need to give the command "close foo.txt" at the end of your AMPL session to ensure that all output is flushed from buffers to the log file. Bob Fourer 4er@... > -----Original Message----- > From: ampl@... [mailto:ampl@...] > On Behalf Of Jacob JKW > Sent: Thursday, June 19, 2008 5:57 AM > To: AMPL Modeling Language > Subject: [AMPL 1839] Re: Appending to logfile? > > > On Jun 12, 8:55 pm, "Robert Fourer" <4...@...> wrote: > > Use ">> filename" to append the output of a command to a specified file. > Although I have found a way around this (I'm just constantly creating > new log files based on the time), this does not appear to work with > writing to with writing logfiles under Windows Vista: > > -------------------- Start Example -------------------- > ampl: model; > ampl: option log_file (">>foo.txt"); > Error executing "option" command: > > can't open ">>foo.txt" > ampl: option log_file (">> foo.txt"); > Error executing "option" command: > > can't open ">> foo.txt" > ampl: option log_file (">>" & "foo.txt"); > Error executing "option" command: > > can't open ">>foo.txt" > ampl: > -------------------- End Example -------------------- > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1844] Re: Appending to logfile?Yep. That does it and certainly makes sense. I guess I'm just too accustomed to the Perl mentality. Thanks again. :) On Jun 19, 11:40 am, "Robert Fourer" <4...@...> wrote: > Don't include >> as part of the log file's name. So for example you could use > any of the following forms: > > option log_file >> ("foo.txt"); > option log_file >> "foo.txt"; > option log_file >> foo.txt; > > In the first of these, you can use any AMPL string expression in place of > "foo.txt" inside the parentheses. Note that these will only append the output > from the "option log_file" command to file foo.txt, however. If you want to > append output of other commands, you will have to follow them with ">> ..." as > well. If you just want to define a log file to which all results of AMPL > commands are written, then don't use >> in the option log_file statement: > > option log_file ("foo.txt"); > option log_file "foo.txt"; > option log_file foo.txt; > > You may need to give the command "close foo.txt" at the end of your AMPL > session to ensure that all output is flushed from buffers to the log file. > > Bob Fourer > 4...@... > > > -----Original Message----- > > From: ampl@... [mailto:ampl@...] > > On Behalf Of Jacob JKW > > Sent: Thursday, June 19, 2008 5:57 AM > > To: AMPL Modeling Language > > Subject: [AMPL 1839] Re: Appending to logfile? > > > On Jun 12, 8:55 pm, "Robert Fourer" <4...@...> wrote: > > > Use ">> filename" to append the output of a command to a specified file. > > Although I have found a way around this (I'm just constantly creating > > new log files based on the time), this does not appear to work with > > writing to with writing logfiles under Windows Vista: > > > -------------------- Start Example -------------------- > > ampl: model; > > ampl: option log_file (">>foo.txt"); > > Error executing "option" command: > > > can't open ">>foo.txt" > > ampl: option log_file (">> foo.txt"); > > Error executing "option" command: > > > can't open ">> foo.txt" > > ampl: option log_file (">>" & "foo.txt"); > > Error executing "option" command: > > > can't open ">>foo.txt" > > ampl: > > -------------------- End Example -------------------- You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1845] Re: Appending to logfile?On Jun 19, 11:40 am, "Robert Fourer" <4...@...> wrote: > If you just want to define a log file to which all results of AMPL > commands are written, then don't use >> in the option log_file statement: > > option log_file ("foo.txt"); > option log_file "foo.txt"; > option log_file foo.txt; > > You may need to give the command "close foo.txt" at the end of your AMPL > session to ensure that all output is flushed from buffers to the log file. Although this still begs the question of whether or not one can define a log file to which all results of AMPL commands are *appended*. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
|
|
[AMPL 1847] Re: Appending to logfile?> -----Original Message----- > From: ampl@... [mailto:ampl@...] On Behalf Of Jacob > JKW > Sent: Friday, June 20, 2008 1:47 AM > To: AMPL Modeling Language > Subject: [AMPL 1845] Re: Appending to logfile? > > On Jun 19, 11:40 am, "Robert Fourer" <4...@...> wrote: > > If you just want to define a log file to which all results of AMPL > > commands are written, then don't use >> in the option log_file statement: > > > > option log_file ("foo.txt"); > > option log_file "foo.txt"; > > option log_file foo.txt; > > > > You may need to give the command "close foo.txt" at the end of your AMPL > > session to ensure that all output is flushed from buffers to the log file. > Although this still begs the question of whether or not one can define > a log file to which all results of AMPL commands are *appended*. Results are always appended to an active log file, until the file is closed or the session is ended. I should have mentioned that to explicitly close a log file, you should issue two commands like: option log_file ''; close foo.txt; Otherwise AMPL will automatically re-open a blank file named foo.txt after the previous foo.txt is closed. Fortunately you don't need to use "close" unless output to the end of your log file is getting lost when you close your session. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group. To post to this group, send email to ampl@... To unsubscribe from this group, send email to ampl-unsubscribe@... For more options, visit this group at http://groups.google.com/group/ampl?hl=en -~----------~----~----~----~------~----~------~--~--- |
| Free Forum Powered by Nabble | Forum Help |