Advertisement
dustingooding

setup_logging.lua

Jul 16th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. require("rttlib")
  2.  
  3. -- Set this to true to write the property files the first time.
  4. write_props=false
  5.  
  6. tc = rtt.getTC()
  7. depl = tc:getPeer("deployer")
  8.  
  9. -- Create components. Enable BUILD_LOGGING and BUILD_TESTS for this to
  10. -- work.
  11. depl:loadComponent("TestComponent","OCL::logging::test::Component")
  12. depl:setActivity("TestComponent", 2.0, 0, 0)
  13.  
  14. depl:loadComponent("AppenderA", "OCL::logging::FileAppender")
  15. depl:setActivity("AppenderA", 0.5, 0, 0)
  16.  
  17. depl:loadComponent("LoggingService", "OCL::logging::LoggingService")
  18. depl:setActivity("LoggingService", 0.5, 0, 0)
  19.  
  20. test = depl:getPeer("TestComponent")
  21. aa = depl:getPeer("AppenderA")
  22. ls = depl:getPeer("LoggingService")
  23.  
  24. depl:addPeer("AppenderA","LoggingService")
  25.  
  26. -- Load marshalling service to read/write components
  27. depl:loadService("LoggingService","marshalling")
  28. depl:loadService("AppenderA","marshalling")
  29.  
  30. if write_props then
  31.     ls:provides("marshalling"):writeProperties("logging_properties.cpf")
  32.     aa:provides("marshalling"):writeProperties("appender_properties.cpf")
  33.     print("Wrote property files. Edit them and set write_props=false")
  34.     os.exit(0)
  35. else
  36.     ls:provides("marshalling"):loadProperties("logging_properties.cpf")
  37.     aa:provides("marshalling"):loadProperties("appender_properties.cpf")
  38. end
  39.  
  40. ls:configure()
  41. ls:start()
  42.  
  43. ls:logCategories()
  44.  
  45. test:configure()
  46. aa:configure()
  47.  
  48. test:start()
  49. aa:start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement