Might be worth looking at the standard ruby logger instead of trying to reinvent it as well?
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html On Wednesday, March 6, 2013 2:06:36 PM UTC-5, Chuck van der Linden wrote: > > I think this is your first clue *"warning: already initialized constant > LogApp "* > > Ruby expects anything you define starting with an upper-case character to > be a constant, and it is complaining that you are re-initializing or > changing the value of LogApp after it has been defined. > > trying refactoring that to log_app or something similar and see if that > works better for you. > > On Monday, February 18, 2013 11:17:16 PM UTC-8, srinivasarao jyothi wrote: >> >> Hi All, >> >> I getting the following error if i run the below mentioned code. >> Please can someone help me out. >> >> Code: >> \\\\\\\\\\\\\\\\\\\\ >> >> class Openapplication< FldrPaths >> def openApplication >> scriptCurrentgPath1= File.expand_path File.dirname(__FILE__) >> require scriptCurrentgPath1+'/LogScript.rb' >> excelApp=WIN32OLE::new('Excel.Application') >> excelBook=excelApp.Workbooks.open(@@fldrArry[0]+'/'+"ApplicationURL.xlsx") >> >> excelSheet=excelBook.Worksheets("URL") >> @@ie=Watir::Browser.new >> @@ie.goto excelSheet.Range('a2').value >> LogApp.logfile "internetexploreropenedsuccessfully", "Pass" >> excelBook.close >> excelApp.quit >> end >> end >> \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Above call is calling the below >> code/////////////////////// >> >> class Logfile >> def logfile (testDescription, result) >> time=Time.now >> testDescription=testDescription >> result=result >> scriptCurrentgPath= File.expand_path File.dirname(__FILE__) >> currentgPath=scriptCurrentgPath.split("GenericFunctions").first >> require scriptCurrentgPath+'/FolderPaths.rb' >> #LogApp.scriptFlderPaths >> logFile=File.open(currentgPath+'Logs/Claims.txt','a+') >> logFile.puts "*****************************************************" >> logFile.puts "logging time is: "+time.inspect+"\n\n" >> logFile.puts testDescription,result >> logFile.puts "*****************************************************" >> end >> end >> LogApp=Logfile.new >> >> >> >> \\\\\\\\\\\\\\\\\\\\\\\\\ >> >> >> >> Error: >> >> >> >> C:/Users/294993/Desktop/ClaimsCAFT/Functions/Login.rb:28: warning: >> already initi >> alized constant LogApp >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1309: [BUG] Segmentation >> fault >> ruby 1.9.2p0 (2010-08-18) [i386-mingw32] >> >> -- control frame ---------- >> c:0026 p:---- s:0079 b:0079 l:000078 d:000078 CFUNC :unlink >> c:0025 p:0022 s:0075 b:0075 l:000067 d:000074 BLOCK >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1309 >> c:0024 p:0034 s:0073 b:0073 l:000072 d:000072 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1317 >> c:0023 p:0011 s:0068 b:0068 l:000067 d:000067 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1308 >> c:0022 p:0033 s:0065 b:0065 l:000064 d:000064 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1297 >> c:0021 p:0013 s:0062 b:0062 l:000041 d:000061 BLOCK >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:761 >> c:0020 p:0008 s:0059 b:0059 l:000044 d:000058 BLOCK >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1347 >> c:0019 p:0035 s:0056 b:0056 l:000055 d:000055 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1351 >> c:0018 p:0011 s:0053 b:0053 l:000044 d:000052 BLOCK >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1346 >> c:0017 p:---- s:0050 b:0050 l:000049 d:000049 FINISH >> c:0016 p:---- s:0048 b:0048 l:000047 d:000047 CFUNC :each >> c:0015 p:0028 s:0045 b:0045 l:000044 d:000044 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:1345 >> c:0014 p:0029 s:0042 b:0042 l:000041 d:000041 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:759 >> c:0013 p:0051 s:0037 b:0037 l:000028 d:000036 BLOCK >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:622 >> c:0012 p:---- s:0034 b:0034 l:000033 d:000033 FINISH >> c:0011 p:---- s:0032 b:0032 l:000031 d:000031 CFUNC :each >> c:0010 p:0118 s:0029 b:0029 l:000028 d:000028 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:618 >> c:0009 p:0069 s:0024 b:0024 l:000023 d:000023 METHOD >> C:/Tech/Ruby192/lib/ruby/1. >> 9.1/fileutils.rb:644 >> c:0008 p:0018 s:0019 b:0019 l:000010 d:000018 BLOCK >> C:/Tech/Ruby192/lib/ruby/ge >> ms/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/file_reape >> >> >> r.rb:39 >> c:0007 p:---- s:0016 b:0016 l:000015 d:000015 FINISH >> c:0006 p:---- s:0014 b:0014 l:000013 d:000013 CFUNC :each >> c:0005 p:0028 s:0011 b:0011 l:000010 d:000010 METHOD >> C:/Tech/Ruby192/lib/ruby/ge >> ms/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/file_reape >> >> >> r.rb:39 >> c:0004 p:0009 s:0008 b:0008 l:00231c d:000007 BLOCK >> C:/Tech/Ruby192/lib/ruby/ge >> ms/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/file_reape >> >> >> r.rb:43 >> c:0003 p:0025 s:0006 b:0006 l:0011b4 d:000005 BLOCK >> C:/Tech/Ruby192/lib/ruby/ge >> ms/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/webdriver/common/platform.r >> >> >> b:124 >> c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH >> c:0001 p:0000 s:0002 b:0002 l:00204c d:00204c TOP >> --------------------------- >> -- Ruby level backtrace information >> ---------------------------------------- >> C:/Tech/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/ >> >> >> webdriver/common/platform.rb:124:in `block in exit_hook' >> C:/Tech/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/ >> >> >> webdriver/common/file_reaper.rb:43:in `block in <module:FileReaper>' >> C:/Tech/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/ >> >> >> webdriver/common/file_reaper.rb:39:in `reap!' >> C:/Tech/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/ >> >> >> webdriver/common/file_reaper.rb:39:in `each' >> C:/Tech/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.29.0/lib/selenium/ >> >> >> webdriver/common/file_reaper.rb:39:in `block in reap!' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:644:in `rm_rf' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:618:in `rm_r' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:618:in `each' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:622:in `block in rm_r' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:759:in `remove_entry' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1345:in `postorder_traverse' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1345:in `each' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1346:in `block in >> postorder_traverse >> ' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1351:in `postorder_traverse' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1347:in `block (2 levels) in >> postord >> er_traverse' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:761:in `block in >> remove_entry' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1297:in `remove' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1308:in `remove_file' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1317:in `platform_support' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1309:in `block in >> remove_file' >> C:/Tech/Ruby192/lib/ruby/1.9.1/fileutils.rb:1309:in `unlink' >> >> [NOTE] >> You may have encountered a bug in the Ruby interpreter or extension >> libraries. >> Bug reports are welcome. >> For details: http://www.ruby-lang.org/bugreport.html >> >> >> This application has requested the Runtime to terminate it in an unusual >> way. >> Please contact the application's support team for more information. >> > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
