Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Script For Deleting Contents of "Live" Log File Post 302448126 by vbe on Wednesday 25th of August 2010 10:24:18 AM
Old 08-25-2010
As mentionned above, moving your file will not solve your issue, another alternative if it works in your case would be to copy (not move!) the file elsewhere, then blanking the log file:
Code:
>logfile

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script that echo " please insert your name " and store the output to a login.log file.

Hello All Nice to meet you all here in this forum, it's my 1rst time here i'm asking about a little issue that i face i added a ksh script that echo " please insert your name " and store the output to a login.log file. the script is working fine with normal telnet but Xstart is not working... (8 Replies)
Discussion started by: islam.said
8 Replies

2. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

3. Shell Programming and Scripting

perl's substitution operator "s" with file contents?

Please show me how to make substitution over the contents of a file in a perl script. In a perl script, the core part of substitution operation is s/FINDPATTERN/REPLACEPATTERN/g; However, I cannot figure out how to make the substitution occur over the contents of a file. The following... (3 Replies)
Discussion started by: LessNux
3 Replies

4. UNIX for Dummies Questions & Answers

Deleting "user input line number" from a file using sed

Hi I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this Enter the line to... (1 Reply)
Discussion started by: sudeep.id
1 Replies

5. Shell Programming and Scripting

Deleting "user input line number" from a file using sed

Hi I want to delete a line from a txt file for which the line number is user input. Say when user selects 19, the 19th line would be deleted from the file. Can anyone please provide me with a sed one liner for the same... I tried sed -i. The interaction would be like this Enter the line... (4 Replies)
Discussion started by: sudeep.id
4 Replies

6. Shell Programming and Scripting

How to find a file which are not ends with ".zip" and which are ends with "*.log*" or "*.out*"?

I am new to bash/shell scripting. I want to find all the files in directory and subdirectories, which are not ends with “.zip” and which are contains in the file name “*.log*” or “*.out*”. I know below command to get the files which ends with “.log”; but I need which are not ends with this... (4 Replies)
Discussion started by: Mallikgm
4 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

replace the contents of first column of file "X" with second Column of file "X" in file "Y"

Hi! I am having 02 files. In first file" X" I am having 02 Columns TCP-5100 Sybase_5100 TCP-5600 Sybase_5600 Second file "Y" for example-- :services ( :AdminInfo ( :chkpf_uid ("{A2F79713-B67D-4409-83A4-A90804E983E9}") :ClassName (rule_services) ) :compound ()... (12 Replies)
Discussion started by: shahid1632
12 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
Poet::Log(3pm)						User Contributed Perl Documentation					    Poet::Log(3pm)

NAME
Poet::Log -- Poet logging SYNOPSIS
# In a conf file... log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout # In a script... use Poet::Script qw($log); # In a module... use Poet qw($log); # In a component... my $log = $m->log; # For an arbitrary category... my $log = Poet::Log->get_logger(category => 'MyApp::Bar'); # then... $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); DESCRIPTION
Poet uses Log::Any and Log::Log4perl for logging, with simplified configuration for the common case. Log::Any is a logging abstraction that allows CPAN modules to log without knowing about which logging framework is in use. It supports standard logging methods ("$log->debug", "$log->is_debug") along with sprintf variants ("$log->debugf"). Log4perl is a powerful logging package that provides just about any logging-related feature you'd want. One of its only drawbacks is its somewhat cumbersome configuration. So, we provide a way to configure Log4perl simply through Poet configuration if you just want common features. Note: Log4perl is not a strict dependency for Poet. Log messages will simply not get logged until you install it or until you modify logging for your app. CONFIGURATION
The configurations below can go in any Poet conf file, e.g. "local.cfg" or "global/log.cfg". Here's a simple configuration that caches everything to "logs/poet.log" at "info" level. This is also the default if no configuration is present. log: defaults: level: info output: poet.log layout: %d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n Here's a more involved configuration that maintains the same default, but adds several categories that are logged differently: log: defaults: level: info output: poet.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %F:%L - %P%n" category: CHI: level: debug output: chi.log layout: "%d{dd/MMM/yyyy:HH:mm:ss.SS} %m - %P%n" MyApp::Foo: output: stdout For the default and for each category, you can specify three different settings: o level - one of the valid log4perl levels (fatal, error, warn, info, debug, trace) o output - can be a relative filename (which will be placed in the Poet log directory), an absolute filename, or the special names "stdout" or "stderr" o layout - a valid log4perl PatternLayout string. If a setting isn't defined for a specific category then it falls back to the default. In this example, "MyApp::Foo" will inherit the default level and layout. Notice that we use '::' instead of '.' to specify hierarchical category names, because '.' would interfere with Poet::Conf dot notation. Finally, if you must use a full Log4perl configuration file, you can specify it this way: log: log4perl_conf: /path/to/log4perl.conf USAGE
Obtaining log handle o In a script (log category will be 'main'): use Poet::Script qw($log); o In a module "MyApp::Foo" (log category will be 'MyApp::Foo'): use Poet qw($log); o In a component "/foo/bar" (log category will be 'Mason::Component::foo::bar'): my $log = $m->log; o Manually for an arbitrary log category: my $log = Poet::Log->get_logger(category => 'Some::Category'); # or my $log = MyApp::Log->get_logger(category => 'Some::Category'); Using log handle $log->error("an error occurred"); $log->debugf("arguments are: %s", @_) if $log->is_debug(); See "Log::Any|Log::Any" for more details. MODIFIABLE METHODS
These methods are not intended to be called externally, but may be useful to override or modify with method modifiers in subclasses. Their APIs will be kept as stable as possible. initialize_logging Called once when the Poet environment is initialized. By default, initializes log4perl with the results of "generate_log4perl_config" and then calls "Log::Any::Adapter->set('Log4perl')". You can modify this to initialize log4perl in your own way, or use a different Log::Any adapter, or use a completely different logging system. generate_log4perl_config Returns a log4perl config string based on Poet configuration. You can modify this to construct and return your own config. SEE ALSO
Poet AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-05 Poet::Log(3pm)
All times are GMT -4. The time now is 01:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy